我正在努力完成以下任务:
我已经修复了左侧边栏的百分比宽度,如下所示:
.sidebar {
position: fixed;
background-color: tomato;
width: 35%;
height: 400px;
}
.. 以及带有固定背景图片的右侧容器:
.right {
background: url('http://farm7.staticflickr.com/6212/6365239995_8f5d03fb30_b.jpg') no-repeat fixed;
height: 400px;
}
如何使背景图像从边栏宽度结束的位置开始,而不是下方?
这是一个 fiddle :http://jsfiddle.net/EKqPg/ (不透明度属性用于演示目的)
最佳答案
.right {
background: url('http://farm7.staticflickr.com/6212/6365239995_8f5d03fb30_b.jpg') no- repeat fixed;
min-height: 400px;
background-size: 65%;
background-position: left 100% top 0px;
}
http://jsfiddle.net/aronez/EKqPg/4/
是这样的吗?
关于css - 固定侧边栏和带有固定背景图像的右侧内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20843665/