leec
01-05-2008, 11:04 PM
Hi,
I'm having my first go at div layouts on a design I'd rather use tables for. It's a very simple design, and I'm getting quite close to what I want, but I've been confounded by a number of things and wondered if anybody could offer some help.
The layout is essentially 4 "rows". The first 3 rows are divided into 2 "columns". The final row is a single column, acting as a footer. I'm putting a small transparent gap of 2px between each row, and between the 2 columns of the first 3 rows.
The top row's divs will contain images and are both fixed size. In the 2nd row's divs, the first column will hold an unordered list for navigation, the second will hold an image of fixed size.
The 3rd row will both contain text, and will not have height specified, but will both be as wide as the divs immediately above them.
The final row is a single column and will contain text, and will be as wide as the entire mess above.
The HTML is:
<!-- Whole Site -->
<div id="container">
<!-- Header -->
<div id="wrapperhead">
<div id="logo"><img src=".jpg" /></div>
<div id="title"><img src=".jpg" /></div>
</div>
<!-- Navigation -->
<div id="wrappernav">
<div id="navigation">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
<div id="picture"><img src=".jpg" /></div>
</div>
<!-- Content -->
<div id="wrappercontent">
<div id="testimonial"></div>
<div id="content"></div>
</div>
<!-- Footer -->
<div id="wrapperfooter">
<div id="footer"></div>
</div>
</div>
My CSS is:
#container{
width: 630px;
}
#wrapperhead{
width: 630px;
}
#wrappernav{
width: 630px;
}
#wrappercontent{
width: 630px;
}
#logo{
width: 180px;
height: 100px;
float: left;
}
#title{
width: 450px;
height: 100px;
float: right;
}
#navigation{
width: 180px;
height: 150px;
float: left;
}
#picture{
width: 450px;
height: 150px;
float: right;
}
#testimonial{
width: 180px;
height: 150px;
float: left;
}
#content{
width: 450px;
height: 150px;
float: right;
}
#footer{
width: 630px;
}
Now, the questions:
Firstly, I am not able to produce the 2px transparent gap between each div in any robust way. Margin-bottom works in IE, but not in FF. Border's work, but not without their problems.
Secondly, when I add a 450x150px jpg to #picture, the div next to it appears slightly shorter in both IE and FF.
Thirdly, when I add the <ul> to #navigation, I seem to have very little control over its placement.
Lastly, I am not able to align the entire site in the centre of the browser without using an overly complicated method which doesn't respond well to the browser window being made very narrow (and therefore not to small screens).
I am very tempted to go back to a table design, but thought I would ask online as someone brighter than me might be prepared to help.
Lee
I'm having my first go at div layouts on a design I'd rather use tables for. It's a very simple design, and I'm getting quite close to what I want, but I've been confounded by a number of things and wondered if anybody could offer some help.
The layout is essentially 4 "rows". The first 3 rows are divided into 2 "columns". The final row is a single column, acting as a footer. I'm putting a small transparent gap of 2px between each row, and between the 2 columns of the first 3 rows.
The top row's divs will contain images and are both fixed size. In the 2nd row's divs, the first column will hold an unordered list for navigation, the second will hold an image of fixed size.
The 3rd row will both contain text, and will not have height specified, but will both be as wide as the divs immediately above them.
The final row is a single column and will contain text, and will be as wide as the entire mess above.
The HTML is:
<!-- Whole Site -->
<div id="container">
<!-- Header -->
<div id="wrapperhead">
<div id="logo"><img src=".jpg" /></div>
<div id="title"><img src=".jpg" /></div>
</div>
<!-- Navigation -->
<div id="wrappernav">
<div id="navigation">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
<div id="picture"><img src=".jpg" /></div>
</div>
<!-- Content -->
<div id="wrappercontent">
<div id="testimonial"></div>
<div id="content"></div>
</div>
<!-- Footer -->
<div id="wrapperfooter">
<div id="footer"></div>
</div>
</div>
My CSS is:
#container{
width: 630px;
}
#wrapperhead{
width: 630px;
}
#wrappernav{
width: 630px;
}
#wrappercontent{
width: 630px;
}
#logo{
width: 180px;
height: 100px;
float: left;
}
#title{
width: 450px;
height: 100px;
float: right;
}
#navigation{
width: 180px;
height: 150px;
float: left;
}
#picture{
width: 450px;
height: 150px;
float: right;
}
#testimonial{
width: 180px;
height: 150px;
float: left;
}
#content{
width: 450px;
height: 150px;
float: right;
}
#footer{
width: 630px;
}
Now, the questions:
Firstly, I am not able to produce the 2px transparent gap between each div in any robust way. Margin-bottom works in IE, but not in FF. Border's work, but not without their problems.
Secondly, when I add a 450x150px jpg to #picture, the div next to it appears slightly shorter in both IE and FF.
Thirdly, when I add the <ul> to #navigation, I seem to have very little control over its placement.
Lastly, I am not able to align the entire site in the centre of the browser without using an overly complicated method which doesn't respond well to the browser window being made very narrow (and therefore not to small screens).
I am very tempted to go back to a table design, but thought I would ask online as someone brighter than me might be prepared to help.
Lee