I've only just started it and I'm trying to get the layout perfect before I start adding mutimedia and images, just so I can tackle problems with each stage logically without getting confused
It'll hopefully be something similar to this:
Banner
Navigation Bar
Main Content: Sidebar on the left and main content on the right
Footer
(I can make a quick picture of how I want it to look if it makes it easier)
I'm using dreamweaver to make the website. In 'design' view it dosn't look perfect, but in Firefox it looks fine, just how I want it, but in IE, the height of the sidebar seems bigger and i'm not sure why! (and also the padding o the main content looks a little different, so if that can be sloved its a plus, lol)
I have a feeling the problem lies with the footer and the clearfloat just before it.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Infamous | Test page</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #333;
}
.twoColFixLtHdr #container {
width: 680px;
margin: 0 auto;
text-align: left; /* this overrides the text-align: center on the body element. */
height: 660px;
padding: 30px 0 0 0;
}
.twoColFixLtHdr #banner {
height: 165px;
width: 680px;
background-color: #999;
}
.twoColFixLtHdr #navbar{
width:720px;
height:30px;
position: relative;
right: 20px;
background-color: #666;
}
.twoColFixLtHdr #sidebar1 {
float: left; /* since this element is floated, a width must be given */
width: 170px;
padding: 2px 10px 2px 20px;
height: 420px;
background-color: #CCC; /* the background color will be displayed for the length of the content in the column, but no further */
overflow: scroll;
overflow-x: hidden;
}
.twoColFixLtHdr #mainContent {
padding: 2px 10px 2px 10px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
overflow: scroll;
height: 420px;
overflow-x: hidden;
width: 460px;
background-color: #FFF;
}
.twoColFixLtHdr #footer {
padding: 0 20px 0 20px;
height: 20px;
background-color: #666;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
-->
</style><!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 170px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<body class="twoColFixLtHdr">
<div id="container">
<div id="banner">
<!-- end #banner --></div>
<div id="navbar">
<!-- end #navbar --></div>
<div id="sidebar1">
<h3>Sidebar1 Content</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. http://www.this-is-a-very-very-long-unbreakable-URL.co.uk</p>
<p>Donec eu mi sed turpis feugiat feugiat.</p>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<h1> Main Content </h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et ipsum et sapien vehicula nonummy. http://www.this-is-another-very-ver-ver-ver-ver-ver-very-long-unbreakable-URL.co.uk </p>
<h2>H2 level heading </h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis.</p>
<!-- end #mainContent -->
</div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<div id="footer">
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
I've checked it with the w3c validator, but it dosn't say anything is wrong, so the problem can't be anything major (correct me if im wrong!)
Any help would be appriciated, I wish I knew where it went wrong to make it easier to pinpoint!
The issues you mentioned, I can't tell a difference. Getting pixel perfect dimensions is a lost cause as each browser will interpret things just a bit differently, but it's nothing to get worried about.
If there's something specific, or something I'm missing, you'll need to clarify.
thanks for the speedy reply! I don't think I explained it very well, so attached are 3 screenies - 1 in Internet Explorer 7, 1 in Mozilla Firefox 3.0.6 and 1 in Dreamweaver CS4 Design View
As you can see, Firefox shows my layout exactly as i planned it
IE shows my layout a little differently as you can see the sidebar on the left seems to be bigger, leaving a gap between my main content and footer
and the DW design view shows a complete gap above my footer... hmm
So i'm wondering what i did wrong to make this gap appear in IE (and probably other browsers i havn't tested too).
I'm thinking either a problem with the css of my #container and\or #sidebar1 & #mainContent, or maybe its a problem with the way i've structured the whole thing!
Hope these screen shots make solving this a little easier!
Hey never mind acctually, i fixed the prob by just reading through the code thoroughly again... sorry to waste your time, the error was here:
Code:
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
I'm such a moron, lol, but no doubt ill be back soon to ask another question!
Bookmarks