navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

CSS Header Alignment

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> CSS Header Alignment
Page: [1]
 
JBW

 

Posts: 54
Joined: 3/18/2004
Status: offline

 
CSS Header Alignment - 3/14/2006 7:51:40   
Hi All,

I am trying to build a header using CSS (get rid of tables) but am getting variable results between browsers (IE7/FF on Win). No matter what I try, fixing one problem creates another and so on. In short, I am hoping that somebody will be able to point out where I am going wrong in the following code:

<style type="text/css">
#Header {
	width: 100%;
	border: #000000 2px solid;
}

.HeaderLeft {
	float: left;
	clear: right;
	border: #000000 2px solid;
}

.HeaderRight {
	float: right;
	clear: left;
	border: #000000 2px solid;
}
</style>

<DIV id="Header">
    <DIV class="HeaderLeft"><img src="logo.gif" width="50" height="50"></DIV>
<DIV class="HeaderRight"><a href="">LINK</a></DIV>
</DIV>

<DIV class="Content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam sed dolor quis erat pharetra pretium. Sed vel neque quis ligula ultricies mattis. Praesent mollis vehicula quam. Morbi pulvinar fringilla eros. Nullam sem magna, sagittis quis, mollis vitae, malesuada nec, sem.
</DIV>



The above code works fine in IE, but FF gives me a totally different result whereby the main header div is collapsed. Which browser is rendering the code correctly and how do I correct the discrepancies? All I am trying to do is create a header with the logo on the left and some links on the right and have all other content fall under the main header div. I have included the border on each div so as to illustrate how each browser renders the pages...

Any help would be greatly appreciated.

John.
womble

 

Posts: 5526
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: CSS Header Alignment - 3/14/2006 8:35:49   
The "clear" properties you've got on the "HeaderLeft" and "HeaderRight" <div>s aren't necessary (there's nothing for them to clear) - one just floats to one side, the other to the other.

Clear the content <div> with:
.Content { clear: both; }

and that'll clear both the logo and the links.

I recreated your problem with the code you've given, but with the changes above, and actually using a 50px x 50px image (I couldn't get it to work just with the filename of the image) it behaved as it should.

HTH

_____________________________

~~ "A cruel god ain't no god at all" ~~
:)

(in reply to JBW)
JBW

 

Posts: 54
Joined: 3/18/2004
Status: offline

 
RE: CSS Header Alignment - 3/14/2006 9:33:44   
Womble,

Thank you so much for your swift reply. I have implemented the changes and everything is fine now. Easy when you know how, eh?

Cheers,

John.

(in reply to womble)
womble

 

Posts: 5526
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: CSS Header Alignment - 3/14/2006 10:01:47   
The joys of css. :) It gets easier as you use it more. :)

_____________________________

~~ "A cruel god ain't no god at all" ~~
:)

(in reply to JBW)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> CSS Header Alignment
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts