html 右侧栏 不滚动,html – 绝对定位的div在右边导致滚动条,当左边没有

我试图“侧翼”一个中心的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;

}

left
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值