[英]How can I control an image being displayed in the html selector in css?
碼:
html {
background: url("/_images/back.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
使用此工具,我可以完美顯示圖像,但不會從頂部顯示整個圖像。 如果在div中,我可以正確顯示它並通過margin-top進行控制,但是使用html時我會受到限制,除非有其他問題。
如何顯示整個圖像? 有沒有類似於margin-top的東西?
background
屬性是CSS某些背景屬性的簡寫 。 其中之一是background-position
,可以保留諸如top
, center
, bottom
或left
和right
或%
, px
, em
, cm
等值的位置。
您無需為此目的使用div。
因此,您可以嘗試使用以下方法background: url("/_images/back.png") no-repeat top left fixed;
。
您是否嘗試過車身標簽? 您也可以嘗試yahoo CSS重置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.