Width 全屏网站,带100%宽度的水平溢出滚动条
我的代码有一个问题,我找不到解决方案。 我有左边的边栏w:300px h:100%,我希望右边的div(内容区)是w:100%,h:100%,带有水平滚动条 但是我的代码有点不对劲,我无法理解,右边的div超过了边栏,如果我把边距放在左边:300px,那么它们300px加在100px的重量上 我希望你能理解我,这是我的密码: HTML:Width 全屏网站,带100%宽度的水平溢出滚动条,width,fullscreen,horizontal-scrolling,css,Width,Fullscreen,Horizontal Scrolling,Css,我的代码有一个问题,我找不到解决方案。 我有左边的边栏w:300px h:100%,我希望右边的div(内容区)是w:100%,h:100%,带有水平滚动条 但是我的代码有点不对劲,我无法理解,右边的div超过了边栏,如果我把边距放在左边:300px,那么它们300px加在100px的重量上 我希望你能理解我,这是我的密码: HTML: 我能够通过以下经过调整的CSS获得您想要的功能: body, html { margin: 0; padding: 0; height:100%; width:
我能够通过以下经过调整的CSS获得您想要的功能:
body, html {
margin: 0;
padding: 0;
height:100%;
width:100%;
}
#wrapper {
width:100%;
height:100%;
display:inline-block;
}
#side_bar {
/*float:left;*/
top:0;
left:0;
width:300px;
height:100%;
position:fixed;
border-right:#000 solid 1px;
background-color:#333;
}
#content {
/*float:left;*/
top:0;
left:0;
height:100%;
width:100%;
position:fixed;
}
#scroll {
height:100%;
/*width:100%;*/
right:0px;
left:301px; /*Because of border */
display:inline-block;
position:absolute;
overflow-x:scroll;
overflow-y:hidden;
white-space:nowrap;
}
希望这有帮助 我能够通过以下经过调整的CSS获得您想要的功能:
body, html {
margin: 0;
padding: 0;
height:100%;
width:100%;
}
#wrapper {
width:100%;
height:100%;
display:inline-block;
}
#side_bar {
/*float:left;*/
top:0;
left:0;
width:300px;
height:100%;
position:fixed;
border-right:#000 solid 1px;
background-color:#333;
}
#content {
/*float:left;*/
top:0;
left:0;
height:100%;
width:100%;
position:fixed;
}
#scroll {
height:100%;
/*width:100%;*/
right:0px;
left:301px; /*Because of border */
display:inline-block;
position:absolute;
overflow-x:scroll;
overflow-y:hidden;
white-space:nowrap;
}
希望这有帮助 您可以使用jQuery插件轻松创建全屏网站:
- 自动滚动移动鼠标滚轮
- 在URL中使用锚(#)
- 与触摸设备兼容
- 与旧浏览器兼容(>IE7)
- 提供回调和许多有用的函数
- 在不同的设备上经过严格测试
- 自动滚动移动鼠标滚轮
- 在URL中使用锚(#)
- 与触摸设备兼容
- 与旧浏览器兼容(>IE7)
- 提供回调和许多有用的函数
- 在不同的设备上经过严格测试
body, html {
margin: 0;
padding: 0;
height:100%;
width:100%;
}
#wrapper {
width:100%;
height:100%;
display:inline-block;
}
#side_bar {
/*float:left;*/
top:0;
left:0;
width:300px;
height:100%;
position:fixed;
border-right:#000 solid 1px;
background-color:#333;
}
#content {
/*float:left;*/
top:0;
left:0;
height:100%;
width:100%;
position:fixed;
}
#scroll {
height:100%;
/*width:100%;*/
right:0px;
left:301px; /*Because of border */
display:inline-block;
position:absolute;
overflow-x:scroll;
overflow-y:hidden;
white-space:nowrap;
}