コミートム合同会社

コミートム合同会社

Vuetify VBtnの背景に画像を設定して中央寄せ

Vuetify VBtn 2 VBtn VBtn This article shows how to set a background image in VBtn of Vuetify and align it to the center. The second VBtn from the left fits the image to the width of the button. The VBtn on the far right adjusts the image to the height of the button.
by JanitorSep 17, 2023
VuetifyのVBtnに背景画像を設定して中央寄せにする方法です。
VuetifyのVBtnに背景画像を設定して中央寄せにする方法です。

Jump Links

1. Vueを作成
1. Vueを作成
1. Vueを作成
下記のソースコードで確認ができます。
下記のソースコードで確認ができます。
<script setup> </script> <template> <VBtn class="mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitWidth mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitHeight mr-5">test</VBtn> </template> <style> .vBtn_BGImg_FitWidth{ background-image: url( /bgImg.webp ); background-size: 100% auto; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } .vBtn_BGImg_FitHeight{ background-image: url( /bgImg.webp ); background-size: auto 100%; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } </style>
<script setup> </script> <template> <VBtn class="mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitWidth mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitHeight mr-5">test</VBtn> </template> <style> .vBtn_BGImg_FitWidth{ background-image: url( /bgImg.webp ); background-size: 100% auto; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } .vBtn_BGImg_FitHeight{ background-image: url( /bgImg.webp ); background-size: auto 100%; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } </style>
表示されるボタンは下の画像の通りです。
表示されるボタンは下の画像の通りです。
左から2番目のVBtnはボタンの幅に画像を合わせています。一番右のVBtnはボタンの高さに画像を合わせています。 参考にさせて頂いたウェブサイトURL https://stackoverflow.com/questions/8200204/fit-background-image-to-div
左から2番目のVBtnはボタンの幅に画像を合わせています。一番右のVBtnはボタンの高さに画像を合わせています。 参考にさせて頂いたウェブサイトURL https://stackoverflow.com/questions/8200204/fit-background-image-to-div

Vuetify VBtnの背景に画像を設定して中央寄せ

Vuetify VBtn 2 VBtn VBtn This article shows how to set a background image in VBtn of Vuetify and align it to the center. The second VBtn from the left fits the image to the width of the button. The VBtn on the far right adjusts the image to the height of the button.
by JanitorSep 17, 2023
VuetifyのVBtnに背景画像を設定して中央寄せにする方法です。
VuetifyのVBtnに背景画像を設定して中央寄せにする方法です。

Jump Links

1. Vueを作成
1. Vueを作成
1. Vueを作成
下記のソースコードで確認ができます。
下記のソースコードで確認ができます。
<script setup> </script> <template> <VBtn class="mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitWidth mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitHeight mr-5">test</VBtn> </template> <style> .vBtn_BGImg_FitWidth{ background-image: url( /bgImg.webp ); background-size: 100% auto; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } .vBtn_BGImg_FitHeight{ background-image: url( /bgImg.webp ); background-size: auto 100%; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } </style>
<script setup> </script> <template> <VBtn class="mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitWidth mr-5">test</VBtn> <VBtn class="vBtn_BGImg_FitHeight mr-5">test</VBtn> </template> <style> .vBtn_BGImg_FitWidth{ background-image: url( /bgImg.webp ); background-size: 100% auto; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } .vBtn_BGImg_FitHeight{ background-image: url( /bgImg.webp ); background-size: auto 100%; background-repeat: no-repeat; background-position: center; color: #FFFFFF00; } </style>
表示されるボタンは下の画像の通りです。
表示されるボタンは下の画像の通りです。
左から2番目のVBtnはボタンの幅に画像を合わせています。一番右のVBtnはボタンの高さに画像を合わせています。 参考にさせて頂いたウェブサイトURL https://stackoverflow.com/questions/8200204/fit-background-image-to-div
左から2番目のVBtnはボタンの幅に画像を合わせています。一番右のVBtnはボタンの高さに画像を合わせています。 参考にさせて頂いたウェブサイトURL https://stackoverflow.com/questions/8200204/fit-background-image-to-div
© 2023 - Comytom LLC