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