我试图创建一个固定的布局,侧边栏的背景延伸到最右侧。我画了一个草图来说明图像:屏幕右侧的侧边栏扩展的居中布局
我怎么会去扩展侧栏背景延伸至右侧屏幕的结束,在任何窗口的大小?我试着用:
#sidebar {
z-index: 1000;
overflow: hidden;
position: absolute;
width: 100%;
background: url(../img/sidebar-base.png) no-repeat 0 -8px;
min-height: 200px;
&::after {
content: '';
z-index: 10;
display: block;
height: 100px;
overflow: hidden;
width: 100%;
background: url(../img/sidebar-rx.png) repeat-x 0 -9px;
position: absolute;
top: 0;
}
}
但滚动会出现水平,如果我在身体上施加overflow:hidden
我将无法滚动至底部。谢谢!
编辑:我也试图找到我的运气与JavaScript,但还是有一点点滚动:
$(function(){
$sidebar = $('#sidebar');
$sidebar.css({width: window.innerWidth - ($sidebar.offset().left)})
});
,只有改变容器 – Michelle