好的,下面是我的 CSS 和 HTML 代码。我一直在为 div 使用百分比,以便这些 div 可以重新调整到更大的屏幕尺寸。烦人的是,当我在计算机上将窗口调整为更小的尺寸时,这些元素会一直移动,直到它们重叠,而我不希望那样。如何使用百分比使这些 div 重新调整为更大的分辨率,但在根据下面的 CSS 和 HTML 将窗口调整为更小的尺寸时不移动
这是CSS
body{
background:#F4F4F4;
background-size:100%;
width:100%;
height:100%;
margin:0 auto;
min-width:1300px;
min-height:750px;
}
.logo{
position:absolute;
left:40%;
top:5%;
}
.logo_homepage{
position:absolute;
left:4%;
top:5%;
}
.homepage_slogan{
position:absolute;
left:3%;
top:45%;
}
.search_box{
position:absolute;
left:30%;
top:30%;
width:35%;
height:50%;
min-width:35%;
min-height:50%;
}
.user_info{
position:absolute;
left:75%;
height:100%;
width:20%;
min-width:20%;
background:white;
}
.header{
position:absolute;
top:0px;
width:100%;
min-width:98%;
height:100px;
min-height:100px;
left:0;
background:#EB6A4A;
}
.slogan{
position:absolute;
top:60%;
left:40.5%;
}
.login{
position:absolute;
top:15%;
left:90%;
}
.whitebackground{
background:#FFFFFF;
}
#slides{
position:absolute;
top:20%;
width:50%;
background:transparent;
height:20%;
left:25%;
}
.socialfeeds{
position:absolute;
top:41%;
width:25%;
height:52%;
min-width:25%;
min-height:52%;
left:25%;
}
.heading{
position:absolute;
top:20%;
width:100%;
min-width:100%;
height:10%;
min-height:10%;
left:2%;
}
.bucket{
position:absolute;
top:18%;
left:20%;
width:13%;
min-width:13%;
}
.title{
position:absolute;
top:20%;
left:32%;
width:30%;
min-width:30%;
}
.feed_icons{
margin:20px;
}
.featured{
position:absolute;
top:30%;
width:30%;
min-width:30%;
background:transparent;
height:60%;
min-height:60%;
left:60%;
}
和 HTML
<body class="whitebackground">
<div class="header">
<div class="logo"><img draggable="false" src="/images/logo.png" /></div>
<div class="slogan"><img draggable="false" src="/images/slogan.png" /></div>
<div class="login"><a href="/twitter/redirect.php"><img draggable="false" src="/images/login.png" /></a></div>
</div>
<div class="bucket">
<span class="feed_icons"><a href="#"><img draggable="false" src="/images/bucket.png"/></a></span>
</div>
<div class="title">
<span class="feed_icons"><a href="#"><img draggable="false" src="/images/title.png"/></a></span>
</div>
<div class="socialfeeds">
<span class="feed_icons"><a href="#"><img draggable="false" src="/images/social_feeds.png" width="100%" height="100%"/></a></span>
</div>
<div class="featured"><img draggable="false" src="/images/featured_list.png" width="100%" height="100%" /> </div>
<div class="footer"> <span style='margin-left:45%;'> COPYRIGHT 2013©</span></div>
</body>