我有包含在一个更大的如下:CSS宽度不匹配在
<div class="content-container">
<div id="content">
Bunch of text ... omitted
</div>
<div id="sidebar">
</div>
</div>
对应于这两个是CSS如下(略编辑的长度):
#content {
margin: 0;
padding: 15px;
width: 720px;
height: 100%;
position: absolute;
left: 0;
border-left: solid;
overflow: auto;
}
#sidebar {
margin: 0;
padding: 15px;
width: 198px;
position: absolute;
right: 0;
height: 100%;
background-color: white;
border-style: solid;
}
.content-container {
position: relative;
width: 978px;
height: 1060px;
}
我有read宽度属性不包括填充。当我在Chrome中加载页面并检查元素时,content
的宽度为705,而不是期望的720.但是,sidebar
的宽度为198px。有没有人有解释?
我得到720.你能检查是否有其他的东西覆盖它吗? https://jsfiddle.net/5xdg4qmw/ – cweitat
是的,它应该给720,我认为这个问题是独占我的网页。但是这很奇怪,因为如果宽度被覆盖,chrome通常会显示一条被删除的线。不知道在哪里检查。 – Abundance
你有它可以检查的活网站吗?谢谢 或者你可以包括所有你的CSS在小提琴 – cweitat