【发布时间】:2019-07-16 05:39:57
【问题描述】:
我开发了一个网站,该网站在最新的 Chrome 版本 75.0.3770.142 中运行良好,而旧版本无法正确呈现,即图像被垂直拉伸。
我用过height:auto。同样的问题出现在 Opera、Safari 和 IE 中。 Mozilla 的最新更新往往运行良好。但是旧版本也有同样的问题。
请帮帮我。我将父元素的高度设置为 auto(与下面显示的媒体查询相同),并且我使用了 flexbox 来居中图像。
@media only screen and (max-width: 414px){
#firstsec{
padding-top: 50px;
padding-bottom: 30px;
height: auto;
text-align: center;
background: url(aliali1.png);
background-size: cover;
background-repeat: no-repeat;
}
#firstsec h1{
font-size: 34px;
padding-bottom: 4px;
}
#firstsec #headerdesign img{
padding-top: 30px;
width:200px;
height:auto;
}
<section id="firstsec" class="parallax col-12">
<div id="headerdesign" class="d-flex justify-content-center col-12">
<img class="col-12 hello" src="https://i.stack.imgur.com/vnaKJ.png" alt="Cannot Load Image">
</div>
<div class="d-flex justify-content-center col-12 animated tada"><h1>“Hello this is Ali!"</br>I'm an Engineer & i like Designing</h1></div>
<button class="button button4 animated flash"><a href="#secondsec">Check out my work !</a></button>
</section>
【问题讨论】:
-
如果您向我们提供响应查看图像的 html 代码会更好
-
我已经添加了。谢谢!
-
您的图片路径不正确,请添加实时图片路径,以便我们为您提供帮助。
-
img 可能是一个弹性元素,所以它的 align-items 属性默认设置为拉伸。尝试覆盖此属性align-items
标签: html css twitter-bootstrap responsive-design