开发者

3 Column CSS Layout needed

Looking at the layout here, I want to constrain the entire page's min width to say, 600px. I've tried setting the content's min-width, however the right hand side overlaps it.

Can someone recommend a way to correct this, or another layout that satisfies this requirement?

The other thing to remember in this is the order the content appears in the code - 1) 2) 3), and as is shown on the page. Either one of the columns should be able to move the footer down, and I would like two more areas defined: What is currently the header to appear as 4) in the code, and 5) to be a small content bar above 4)

So in short the page content areas would appear like this on the page (ordered from top to bottom, starting at 1) in the code):

7) top menu
5) header
4) contentbar
2) 1) 3)
6) (footer)

Thanks.

Update

With a bit of assistance, from Midas, I've managed to almost get what I'm looking for. The problem below is that the right-hand column does not move the footer down, nor does it lock into place at the min-width, when the browser width is reduced. Also, I still can't push everything down for the top menu bar, as it is just overlapping the header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Holygrail1</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
* { 
    margin:0; padding:0 
}
body { 
    font:76% Arial, Helvetica, sans-serif 
}
p { 
    margin:0 10px 10px 
}
a {
    display:block; color:#981793; padding:10px 
}

#container 
{
    margin-top:104px; min-height:400px;
    min-width:700px;
    top:20px;
}
#wrapper { 
    float:left; width:100% 
}
#content { 
    margin: 0 200px 0 200px
}
#content p {    
    line-height:1.4 
}
#leftbar { 
    background:#b9caff; float:left; width:200px; margin-left:-100% 
}
#rightbar { 
    position: absolute;
    background:#ff8539; 
    right:0px;
    width:200px; 
}
#header { 
    position:absolute; top:0; width:100%; height:266px;
}
#header h1 { 
    line-height:80px; padding-left:10px; background:#eee; color:#79b30b 
}
#contentbar { 
    position:absolute; top:80px; width:100%; z-index:1 
}

#footer, #contentbar { 
    background:#333; color:#fff 
}
#footer p, #contentbar p { 
    margin:0; padding:5px 10px; line-height:14px 
}
#footer { 
    clear:left; width:100% 
}

#topbar { 
    position:absolute; top:0px; width:100%; z-index:1;
    height: 20px;
    background-color:red;
}

</style>
</head>
<body>
    <div id="container">
        <div id="wrapper">
            <div id="content">
                <p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p>
            </div>
        </div>
        <div id="leftbar">
            <p><strong>2) leftbar here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long filler</p>
        </div>
        <div id="rightbar">
            <p><strong>3) More stuff here.</strong> very text make long column make filler fill make column column silly filler text silly column fill silly fill column开发者_运维百科 text filler make text silly filler make filler very silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very</p>
                <p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column</p>
                <p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very</p>
                <p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very</p>
        </div>
    </div>
    <div id="contentbar"><p>4) Content bar here.</p></div>
    <div id="header"><h1>5) Header</h1></div>
    <div id="footer"><p>6) Here it goes the footer</p></div>
    <div id="topbar"><p>7) Top Bar </p></div>
</body>
</html>


Since this is not a pay-for-code site, I am not going to code that whole thing for you.

This might be a stupid question, but does this not work for you?

body {
  min-width: 600px;
}


Here is your reviewed layout. The ordering is like you wanted it, I had to use position:absolute for the header and 'content bar'.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Layout 19</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
* { margin:0; padding:0 }
body { font:76% Arial, Helvetica, sans-serif; min-width:600px }
a { display:block; color:#981793; padding:10px }
#navigation, #extra, #header, #contentbar { position:absolute; top:0 }
#container { margin-top:104px; position:relative }
#container p { margin:0 10px 10px }
#content { margin:0 200px }
#content p { line-height:1.4 }
#navigation { background:#b9caff; width:200px }
#extra { background:#ff8539; width:200px; right:0 }
#header { width:100% }
#header h1 { line-height:80px; padding-left:10px; background:#eee; color:#79b30b }
#contentbar { margin-top:80px; width:100% }
#footer, #contentbar { background:#333; color:#fff }
#footer p, #contentbar p { padding:5px 10px; line-height:14px }
    </style>
</head>
<body>
    <div id="container">
        <div id="content">
            <p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p>
            <p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column</p>
            <p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very</p>
            <p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very</p>
        </div>
       <div id="navigation">
            <p><strong>2) Navigation here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long filler</p>
        </div>
        <div id="extra">
            <p><strong>3) More stuff here.</strong> very text make long column make filler fill make column column silly filler text silly column fill silly fill column text filler make text silly filler make filler very silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very</p>
        </div>
    </div>
    <div id="contentbar"><p>4) Content bar here.</p></div>
    <div id="header"><h1>5) Header</h1></div>
    <div id="footer"><p>6) Here it goes the footer</p></div>
</body>
</html>


This Example can be set at a constant width:600px in either the <body> tag or around the outer-most <div> tag(s).

A more detailed explanation of this layout can be found on A List Apart - Holy Grail

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜