粉红色的内容将在它后面。我设法创建了这个,但需要通过 javascript 扩展高度。窗口调整大小、滚动等是我可以让两侧一直向下连接到底部的唯一方法。我根本不想使用 JS。有任何想法吗?
添加了我到目前为止所拥有的:jsFiddle
CSS:
body {
background: #FF3300;
}
.border-top {
display: block;
z-index: 10;
position: absolute;
top:0;
right:0;
left:0;
margin: 20px 20px 0 20px;
border-top: 5px solid #d3ad42;
background: none;
pointer-events: none;
}
.border-right {
margin: 20px 20px 20px 0;
display: block;
z-index: 10;
position: absolute;
top:0;
right:0;
bottom: 0;
border-right: 5px solid #d3ad42;
pointer-events: none;
}
.border-bottom {
display: block;
z-index: 10;
position: fixed;
height: 20px;
bottom:0;
right:0;
left:0;
margin: 0 20px 0 20px;
border-top: 5px solid #d3ad42;
background: inherit;
pointer-events: none;
}
.border-left {
margin: 20px 0 20px 20px;
display: block;
z-index: 10;
position: absolute;
top:0;
left:0;
bottom:0;
border-left: 5px solid #d3ad42;
pointer-events: none;
}
.content {
padding: 40px;
min-height: 1400px;
}
JS:
var WIDTH, HEIGHT, SCROLL;
document.addEventListener("scroll", resize, false);
function resize() {
HEIGHT = $(window).height();
WIDTH = $(window).width();
SCROLL = $(document).scrollTop();
// BORDER
$('.border-left').height(HEIGHT + SCROLL - parseInt($('.border-left').css('margin-top'), 10) * 2);
$('.border-right').height(HEIGHT + SCROLL - parseInt($('.border-right').css('margin-top'), 10) * 2);
}