【发布时间】:2014-09-03 23:39:31
【问题描述】:
我想同时使用background-size:contain 和background-size:cover。我想让我的背景图像始终拉伸浏览器窗口的 100% 宽度 x 100% 高度,同时保持图像的比例。
Here is a perfect example of what I'm trying to do
有没有纯css路由来实现这个?
这是我的代码:
<div class="page-section clear">
<div class="landing_photo clear" style="background-image:url('<?php echo get_template_directory_uri(); ?>/img/tempory_landing.png');">
</div>
</div>
.page-section {
width:100%;
height:100%;
margin:auto;
}
.landing_photo {
width:100%;
height:100%;
background-position:center center;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
background-size:cover;
background-repeat:no-repeat;
}
【问题讨论】:
标签: css background-size