我在理解某些具有响应式设计的 CSS 时遇到了一些问题。基本上我想要一个固定位置的侧边栏在左边,内容在右边,右边的内容是响应式的。当我缩放浏览器时,内容框位于侧边栏后面,而不是缩小自身。我只是无法正确设置CSS。
这是我目前所拥有的。
.sidebar {
position: absolute;
left: 0;
top:0;
height: 100%;
background: url(../images/sidebar.png) repeat-y top left;
width: 225px;
}
.content {
width: 45%;
float: left;
}
.container {
width: 100%;
height:100%;
}
侧边栏 div 位于容器 div 和内容 div 之上,任何帮助都会很棒,因为我开始脱发 :(
最佳答案
你不要在这里写你的 html。
我猜你可以通过 magin 解决这个问题:
.content {
width: 45%;
float: left;
margin-left:230px;
}
关于css - 具有内容响应的固定位置侧边栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13375552/