在最小化或调整浏览器大小时,保持内容不会移动

时间:2015-04-10 06:17:26

标签: html css webpage

我是新手,所以我遇到这个问题,当浏览器最小化时,页面中的内容会被移动。当浏览器最小化时,包含徽标的内容将被移动,内容将移出蓝色透明背景。

这是我的css代码

   #full-screen-background-image {
 z-index: -999;
 min-height: 100%;
 min-width: 1300px;
 width: 100%;
 height: auto;
 position: absolute;
 top: 0;
 left: 0;
 }

  .whole{
  margin: 0px auto;
  height: 1242px;
  width: 1000px;
  }

  .clear{
margin: 0 auto;
clear: both;
}

 .logo {
width: 460px;
height: 170px;
margin: 0 auto;
}

.fax {
 margin: 0 auto;
 width: 480px;
 height: 110px;
 margin-right: 267px;
 }

.fax p {
    color: white;
    font-family: 'Istok Web', sans-serif;
    font-size: 35px;
    text-align:center;
    float:left;
    margin: 0 auto;
    margin-top: 55px;
    width: 394px;
}

.faxLogo{
    float: left;
height:60px;
width: 60px;
margin: 0 auto;
margin-top: 40px;
margin-left: -385px;
}


 .tel{
margin: 0 auto;
width: 480px;
height: 70px;
margin-right: 267px;
}

.telDetails{
float:left;
height: 10px;
}

.telLogo{
float: left;
height:60px;
width: 60px;
margin: 0 auto;
margin-top: -10px;
margin-left: 65px;
}

.tel p {
    color: white;
    font-family: 'Istok Web', sans-serif;
    font-size: 35px;
    text-align: center;
    margin:0 auto;
    margin-top: 10px;
    margin-left: 10px;
}

 .locationLogo{
    float: left;
    height: 60px;
    width: 60px;
    margin: 0 auto;
    margin-left: 65px;
}




.location{
margin: 0 auto;
width: 500px;
 }

.location p {
    color: white;
    font-family: 'Istok Web', sans-serif;
    font-size: 35px;
    float: left;
    margin:0 auto;
    margin-top: -35px;
    margin-left: 160px;
    line-height: 60px;
}

.detail1 {
    margin: 0 auto;
    text-align:center;
}

.detail1 p{
    font-size: 45px;
    font-family: 'Istok Web', sans-serif;
    color:white;
    text-align:center;
    margin-left: 130px;
}

.detail2 {
    font-size: 45px;
    font-family: 'Istok Web', sans-serif;
    color: white;
    margin: 0 auto;
}

.detail2 p{
    margin-top: -20px;
    text-align:center;
    margin-left: 45px;
}

这是我的HTML代码

<div class="clear" style="height: 445px;"></div>

<div class="whole">

    <div class="logo"><img src="images/logo_3.jpg" /></div>

    <div class="clear" style="height:50px;"></div>

    <div class="detail1">
        <p>TEXT</p>

    </div>
    <div class="detail2">
        <p>TEXT</p>
    </div>

    <div class="clear" style="margin-top:-53px;"></div>

    <div class="location">
        <div class="locationLogo">
            <img src="images/location.png" />
        </div>
        <div class="locationDetails">
            <p style="width: 500px;">TEXT<br />TEXT<br />TEXT</p>
        </div>
    </div>

    <div class="tel">
        <div class="telLogo" style="width: 10px;">
            <img src="images/tel.png" />
        </div>
        <div class="telDetails">
            <p style="width: 365px;">TEXT</p>
        </div>
    </div>

    <div class="fax">
        <div class="faxLogo" style="width: 10px;">
            <img src="images/fax.png" />
        </div>
        <div class="faxDetails">
            <p style="width: 394px;">TEXT</p>
        </div>
    </div>

</div>

1 个答案:

答案 0 :(得分:0)

当窗口调整大小但透明框是背景图像的一部分时,透明框内的内容会移动。使用石油钻井平台作为背景图像,并将您的内容放在div中。像这样:

&#13;
&#13;
.box {
    width: 100%;
    height: auto;
    background-color: rgba(0,0,255,0.5);
}
&#13;
<div class="box">
    <ul>
        <li>SOME CONTENT HERE</li>
        <li>SOME CONTENT HERE</li>
        <li>SOME CONTENT HERE</li>
        <li>SOME CONTENT HERE</li>
    </ul>
</div>
&#13;
&#13;
&#13;

您现在可以将div放在您认为合适的位置。