移动设备中的图像宽度和高度问题

时间:2020-03-13 11:38:50

标签: html css

所以我有这样的标题设计(请参见下图

header design

因此,该网站的桌面版本一切正常,但是移动版本存在问题。图像无响应。基本上我想将标头设计转换为工作代码。请帮忙!

代码


html, body {
    padding:0;
    margin:0;
    width: 100%;
    height: 100%;
}

#img{
    position: absolute;
    right: 100;
    top: 35px;
    z-index: -1;
    width: 30%;
}


#img2{
    position: absolute;
    right: 0;
    left: 100;
    margin-top: 30px;
    margin-left: 10em;
    top: 50px;
    z-index: -1;
    width: 30%;
}
<header>
    <div class="col-lg-12" style="margin-bottom: 10em;">
        <div class="row">
            <div class="col-lg-8  my-auto mt-3 mb-5">
                <h2 style="font-weight: bolder;margin-top: 2em;margin-left:1em;font-size: 7vw;font-family: 'Poppins', sans-serif;" data-sal="slide-up" style="margin-left: 1.5em;" data-sal-delay="1500" data-sal-easing="ease-out-bouce" data-sal-duration="1200"><span class="mb-5">Capture your</span><br><span>priceless</span><br><span>moments</span><br><span>with aw zone</span></h2>     
                </div>
                <div id="img">
                    <img src="https://images.pexels.com/photos/1024613/pexels-photo-1024613.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="" width="300" class="thumbnail">
                </div>
                <div id="img2">
                    <img src="https://images.pexels.com/photos/1024613/pexels-photo-1024613.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="" width="300">
                </div>
        </div>
  </div>
  </header>

1 个答案:

答案 0 :(得分:0)

对于移动版,您必须在CSS中插入媒体查询。选中此link,您肯定会找到答案。只需将媒体查询添加到您的CSS代码中即可。