簡體   English   中英

如何使圖像適應按鈕大小?

[英]How to adapt image to button size?

如何使按鈕的背景圖像適應按鈕的大小? 如果我的圖片是2800x1300,如何使其適應1000x540按鈕? 請幫助有需要的人!

確實取決於情況,但這可能會有所幫助:

background-size: cover

要么

background-size: contain

查看最有效的方法。

使用: background-size:cover;

小提琴

 .button { background: url(http://theimageconference.org/wp-content/uploads/2014/01/images-50x50.png) no-repeat; cursor: pointer; border: none; background-size: cover; width: 50px; height: 50px; } 
 <input type="button" name="button" class="button" /> 

您可以使用background-size:cover;

它將背景圖像縮放到盡可能大的程度,以使背景區域完全被背景圖像覆蓋。 在背景定位區域內可能看不到背景圖像的某些部分

要了解其工作原理,請點擊此處

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM