【发布时间】:2020-02-02 00:21:51
【问题描述】:
我有一个 wordpress 网站,顶部有一个容器来显示背景图片。我希望背景与 div 高度保持成比例,以根据屏幕大小进行调整。我目前正在使用高度标签来显示这个区域(参见下面的 CSS)。我基本上希望它在网站很大时不会溢出(在更高分辨率时它会隐藏图像的底部),并且在网站很小时不会在底部显示白色。
如何使高度响应?
您可以在此处查看该网站:http://69.195.124.65/~flywitha/
CSS:
.top_site{
background: rgba(0, 0, 0, 0) url("/wp-content/themes/alex/images/mast_w-kid_1920x800.jpg") no-repeat scroll right bottom;
background-size: contain;
}
.top_site h1{
font-family:lato, sans-serif;
color:rgba(40, 40, 40, 0.8);
padding: 15% 0 9.255% 15%;
margin:0;
width:50%;
font-size:6rem;
font-weight:bold;
-webkit-text-stroke: 1px black;
text-shadow:
3px 3px 0 #000,
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
}
HTML:
<div class="top_site">
<h1 class="site-hdr-tag inset-text">
the<br>
INTERACTIVE<br>
AEROSPACE<br>
LEARNING<br>
CAMPUS
</h1>
</div>
【问题讨论】: