繁体   English   中英

如何控制CSS中HTML选择器中显示的图像?

[英]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 ,可以保留诸如topcenterbottomleftright%pxemcm等值的位置。

您无需为此目的使用div。

因此,您可以尝试使用以下方法background: url("/_images/back.png") no-repeat top left fixed;

您是否尝试过车身标签? 您也可以尝试yahoo CSS重置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM