我试图“侧翼”一个中心的div,一些设计元素绝对位于主div宽度之外.由于右侧的元素,而不是左边的元素(IE6 / 7/8,Chrome,Firefox),我正在滚动条.如何摆脱这个水平滚动条?
html,body {
height: 100%;
width: 100%;
margin: 0;
}
body { text-align: center; }
.wrapper {
margin: 0 auto;
position: relative;
width: 960px;
z-index: 0;
}
.main {
background: #900;
height: 700px;
}
.right,.left {
position: absolute;
height: 100px;
width: 100px;
}
.right {
background: #090;
top: 0px;
left: 960px;
z-index: 1;
}
.left {
background: #009;
top: 0px;
left: -100px;
z-index: 1;
}
这可以在IE6-9,FF3.6,Safari 5和Chrome 5中运行.似乎没有关系我扔给我的是什么类型的文件(没有,xhtml 1过渡,html5).希望这有帮助,那是一个有趣的问题.
html,body {
margin: 0;
padding: 0;
text-align: center;
}
body {
overflow: auto;
}
#container {
min-width: 960px;
zoom: 1; /*For ie6*/
position: relative; /*For ie6/7*/
overflow: hidden;
margin: 0 auto;
}
#main {
background: #cea;
width: 960px;
margin: 0 auto;
height: 700px;
position: relative;
top: 0;
}
#right,#left {
position: absolute;
height: 100px;
width: 100px;
top: 0;
z-index: 100;
}
#right {
background: #797;
right: -100px;
}
#left {
background: #590;
left: -100px;
}