我遇到了与内置浏览器缩放(ctrl + scroll)相关的问题。 我即将在左侧建立一个带有垂直导航栏的站点,这是非常标准的东西...所有看起来都很好的列表对象被一个" border-bottom:1px纯黑色"分开。 listobjects完美地定位在parent-div的底部。
直到我开始使用浏览器缩放检查我的页面。然后是最后一个列表对象底部的边框"跳转"在一个档位下方并且被放置在父级div之下...如果我继续放大该站点,则会无法控制地跳跃。
有没有人有解决方案? (在下面粘贴我的代码)
* {
margin: 0;
padding: 0;
}
body {
background-color: lightblue;
}
div#wrapper {
width: 1300px;
height: 600px;
border: 1px solid black;
margin: 20px auto 0px auto;
}
div#header {
width: 100%;
height: 100px;
border-bottom: 1px solid black;
background-image: url(".././bilder/headerBG.jpg");
}
div#header > h1 {
color: white;
padding-top: 15px;
text-align: center;
font-size: 55px;
font-family: Algerian, "Times New Roman";
}
div#navbar {
width: 300px;
height: 500px;
border-right: 1px solid black;
}
div#navbar > ul {
text-align: center;
}
div#navbar > ul > li {
list-style-type: none;
border-bottom: 1px solid black;
font-size: 25px;
}
div#navbar > ul > li > a {
color: black;
text-decoration: none;
display: block;
box-sizing: border-box;
width: 100%;
padding: 35.5px 0;
}
div#content {
width: 1000px;
height: 500px;
float: right;
}
div#footer {
width: 1300px;
height: 50px;
margin: 0px auto;
border-left: 1px solid black;
border-bottom: 1px solid black;
border-right: 1px solid black;
clear: both;
}

<div id="wrapper">
<div id="header">
<h1>Hello DIV</h1>
</div>
<div id="navbar">
<ul>
<li><a href="#">Start</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Vision</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div id="content">
</div>
</div>
<div id="footer">
</div>
&#13;
答案 0 :(得分:0)
您好我刚检查了您的Css,问题是由于以下div的高度:
#wrapper & #navbar
有一个名为#content
的空白div,因为你看到了一个凹陷!
为了避免它从#content
删除高度