Forum Moderators: not2easy

Message Too Old, No Replies

Nested layers in center page aligned main layer

How to?

         

silverbytes

8:34 pm on May 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I saw it's possible to align to center of page a layer. But is it possible to have nested layers inside that main layer?
The objective a 780 px wide main layer centered on page and inside other layers to complete layout.
If is there any example out there would be great!

tedster

9:14 pm on May 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand you correctly, it's not only possible, it's completely straightforward mark-up. Just nest your divs inside the centered container.

silverbytes

6:55 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I nest divs inside the centered layer?

iamlost

8:00 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I used absolute positioning within a relative wrapper as the easiest for example purposes. There are many other convolutions.

CSS:


* {padding: 0; margin: 0;
}
html, body {width: 100%; height: 100%; background: #000;text-align: center; /* to centre IE */
}
#wrapper {position: relative; width: 780px; height: 100%; margin: 0 auto; /* to centre compliant browsers */ text-align: left; /* to reset text alignment to default */
}
#header {position: absolute; left: 0; top:0; width: 80%; height: 15%; background: #f0f;
}
#logo {position: absolute; right: 0; top: 0; width: 20%; height: 20%;
background: #0f0;
}
#content {position: absolute; left: 0; top: 20%; width: 80%; height: 80%; background: #0ff;
}
#nav-top {position: absolute; left: 0; top: 15%; height: 5%; width: 80%; background: #ff0;
}
#nav-side {position: absolute; width: 20%; height: 80%; top: 20%; left: 80%; background: #ff0;
}

HTML:


<div id="wrapper">
<div id="content">Content</div>
<div id="header">Masthead</div>
<div id="logo">Logo</div>
<div id="nav-top">Top Navigation Links</div>
<div id="nav-side">Side Navigation</div>
</div>

silverbytes

10:28 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks I'll try!