开发者

Tableless layout with two liquid columns (liquid - fixed - liquid)

开发者 https://www.devze.com 2023-03-06 07:48 出处:网络
So, this web application I\'m working in haves three vertical columns expanding for the entire window height, and a footer div expanding for the entire width. The layout looks like this:

So, this web application I'm working in haves three vertical columns expanding for the entire window height, and a footer div expanding for the entire width. The layout looks like this:

+|+
---

where + means a liquid column, | means a fixed c开发者_如何转开发olumn, and - the footer.

I've done the element positioning using absolute and relative positioning with some tweaks using jQuery. But I want to know if there is a way of doing this with CSS3 only.

Thanks!


This neglects all browser not supporting the box-orient and box-flex properties (like IE).

Demo: http://jsfiddle.net/p8vBC/11/

CSS:

html, body {
    height: 100%;
    padding: 0px;
    margin: 0px;
}

body > #main {
    display: -webkit-box;
    -webkit-box-orient: horizontal;

    display: -moz-box;
    -moz-box-orient: horizontal;

    display: box;
    box-orient: horizontal;

    height: 100%;
    margin-bottom: -100px;
}

footer {
    height: 100px;
    box-flex: 1;
    -webkit-box-flex: 1;
    -moz-box-flex: 1;
}

aside {
    box-flex: 1;
    -webkit-box-flex: 1;
    -moz-box-flex: 1;
}

#content {
    width: 400px;
}

HTML:

<div id="main">
    <aside id="left"></aside>
    <div id="content"></div>
    <aside id="right"></aside>
</div>

<footer></footer>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号