Forum Moderators: not2easy

Message Too Old, No Replies

A little help would be nice

The joy of a split container

         

WHeights

3:31 pm on Mar 11, 2004 (gmt 0)

10+ Year Member



Hello there,
I'm not new to CSS but i've only just recently started trying to use css for positioning.

Anyways, below you will find my code that I would like you to try and help me with. The main aim is to have a header (central), navbar (directly below it and central), container (following on directly and central) and a footer (the same as the rest).
The only thing I am having problems with is the container... I want to split it into 1 large left column and one small right column by using two extra divs. See if you can help me from my code.

(This is the html code)

------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<title>Last attempt </title>

<link rel="stylesheet" type="text/css" href="important.css">

</style>

</head>

<body>

<div id="header">
<div id="headercol">Header content</div></div>

<div id="navbar">
<div id="navbarcol">Navbar content</div></div>

<div id="container">

<div id="column1"><h1>lorem ipsum dolor</h1>

<h2>duis autem</h2>

<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.</p>

<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>

</div>
<div id="column2">Column 2 content</div></div>

<div id="footer">content here </div>

</body>

</html>

-----------------------------------------------------

(This is the external stylesheet)

-----------------------------------------------------

body {

margin: 0;

}

#header {

position: relative;
background-color: #399;
top: 0px;
left: 0px;
margin-right: 100px;
margin-left: 100px;
margin-top: 15px;
height: 60px;

}

#navbar {

position: relative;
background-color: #ccc;
top: 0px;
left: 0px;
margin-right: 100px;
margin-left: 100px;
height: 30px;

}

#container {

postion: relative;
background-color: #399;
top: 0px;
left: 0px;
margin-right: 100px;
margin-left: 100px;
border: 1px solid #000;

}

#footer {

position: relative;
background-color: #ccc;
top: 0px;
left: 0px;
height: 30px;
margin-left: 100px;
margin-right: 100px;

}

------------------------------------------------------

How would I split the container? I have tried using - relative and absolute positioning... as well as float.

p.s lol please note that the colours used are only for testing purposes. I only care about the container.

mattr555

6:14 pm on Mar 11, 2004 (gmt 0)

10+ Year Member



Move column 2 so that i occurs before column one in the html markup.

Then simply add float:right to the column 2 div.

You may need to play with the column 2 width and column 1's right margin but the float and changing the order of the div's in the markup should give you the simple 2 columns you are after.

WHeights

7:37 pm on Mar 12, 2004 (gmt 0)

10+ Year Member



Another question is: If I try using absolute divs inside the container i've created... surely both of the absolute div's parent should be the container and not the top left of the viewport...
The float method won't work for what I want, mainly because it continues to expand.
I need to ensure the large left column within the container can expand... and that the smaller right column can contain various boxes.. like "latest blah blah".
The style I am looking for is much like alistapart's website. Any help would be appreciated.

mattr555

2:19 pm on Mar 13, 2004 (gmt 0)

10+ Year Member



if you are inspired my listapart, just copy their stylesheet and strip it down so it gives you the basic layout you need.