[英]3 grid layout: fixed sidebars and fluid content
I want to create a layout whose its structure is a mixed-type. 我想创建一个布局,其结构是混合类型。 I want two sidebars: one in the left side, another in the right side - both of them has 250px of width; 我想要两个侧边栏:一个在左侧,另一个在右侧 - 两个都有250px的宽度; in the middle, I just want the content whose its width is fluid. 在中间,我只想要宽度适中的内容。
I can make some math to solve my problem like calc(100% - 500px)
, but I really don't want to use CSS3 for this – I want a cross-browser solution, and it can be pure CSS2 or JavaScript. 我可以做一些数学来解决我的问题,比如calc(100% - 500px)
,但我真的不想使用CSS3 - 我想要一个跨浏览器的解决方案,它可以是纯CSS2或JavaScript。
Can someone suggest me something? 有人可以给我一些建议吗? It can be a grid system, functions, etc. 它可以是网格系统,功能等。
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
css CSS
.left{
width: 250px;
position: absolute;
left: 0;
}
.center{
display: table;
position: absolute;
left: 250px;
right: 250px;
}
.right
width: 250px;
position: absolute;
right: 0;
}
var documentWidth = $(document).width();
documentWidth = documentWidth.split('px')[0];
var middleDivWidth = documentWidth - 500;
$('#middleDivId').css('width',middleDivWidth+'px');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.