Solved

div pushed down in firefox

Posted on 2009-05-13
7
381 Views
Last Modified: 2013-12-07
can someone please help me figure out why the code below renders fine in ie, but is pushed down in firefox?

thanks
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Merrick Construction</title>
 
<style type="text/css">
 
html {
margin: 0px;
padding: 0px;
height: 100%;
}
 
img {
margin 0;
}
 
body {
margin: 0;
padding: 0;
color:black;
font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
 
a:link {text-decoration:none; color:#000000;}
a:visited {text-decoration:none; color:#000000;}
a:active {text-decoration:underline; color:#cc0000;}
a:hover {text-decoration:none; color:#cc0000; }
 
#header{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
color:white;
background-color: #ffcc33;
background: blue url(images/yellow_header_background.jpg) top repeat-x;
height: 200px;
}
 
#main{
margin: 0;
padding: 0;
width:100%;
height: 400px;
background-color: #8CB1FF;
background: blue url(images/test_merric_main_bckgrnd.jpg) top repeat-x;
color:black;
font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
 
#navbar{
margin: 0;
padding: 0;
width: 100%;
/* background-color:#fff2cc; */
background-color:#000000;
background-color:#ffffff;
/* background-color:#cc0000; */
}
 
#navlist{
margin: 165px 0px 0px 500px
/* padding: 140px 0px 0px 500px; */
}
 
#navlist li
{
font-size: 14px;
font-family: Verdana, Arial, Helvetica, sans-serif;
display: inline;
list-style-type: none;
padding-right: 40px;
}
 
#footer
{
margin 0;
padding 0;
width: 100%;
height: 150px;
background-color:#404040;
background-color:#7f7f7f;
color:#ffffff;
}
 
</style>
</head>
 
<body>
 
<div id="header"><img style="float:left; margin:0px 0px 0px 150px;" src="images/Merrick_Logo_Transparent180.jpg"/>
<ul id="navlist">
<li id="active"><a href="#" id="current">Home</a></li>
<li><a href="#">Project Gallery</a></li>
<li><a href="#">Testimonials</a></li>
<li><a href="#">About Merrick</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
 
<div id="navbar">
<p>just hanging in navbar for now</p>
</div>
 
<div id="main">
<p>In Main</p>
<p style="color: #cc0000;">here's some red text</p>
<p style="color: #ffcc33;">here's some yellow text</p>
<p style="color: #81371D;">here's some brick text</p>
<p style="color: #ffffff;">here's some white text</p>
</div>
 
<div id="footer">footer</div>
 
</body>
</html>

Open in new window

0
Comment
Question by:shinnmill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 18

Accepted Solution

by:
Rartemass earned 225 total points
ID: 24380230
Its to do with the image in the header floating left.
If you remove the float the image adjusts to the top of the page.
The menu will then be out of alignment with the white bar but that can be adjusted with padding or margins.

<div id="header"><img style="float:left; margin:0px 0px 0px 150px;" src="images/Merrick_Logo_Transparent180.jpg"/>

0
 
LVL 20

Assisted Solution

by:ddayx10
ddayx10 earned 225 total points
ID: 24380294
It's doing that because of a combination of the fact that you are floating the img and the margin you have set in #navlist.

If you add the clear attribute tto the ul below:
<ul id="navlist" style="clear:both;">

...and change the margin to padding it mostly fixes it. You are still in for some tweaking but that is the jist of why this is happening.

Good Luck,

dday
0
 

Author Comment

by:shinnmill
ID: 24380329
thanks

one more question

why is the white bar wider in ff than in ie?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:ddayx10
ID: 24380414
You have a <p> inside a <div>.

The div has css set, but the p does not. Set the margin/padding for that <p> tag as you have the others and I suspect the issue will disolve.

dday
0
 
LVL 42

Assisted Solution

by:David S.
David S. earned 50 total points
ID: 24381674
To add to what ddayx10 said, in Firefox the <p> has default top and bottom margins which is why it's taller than in IE.

Another issue is that the doctype is missing.

Recommended reading:
http://dev.opera.com/articles/view/14-choosing-the-right-doctype-for-your/
http://www.dynamicsitesolutions.com/blog/2008/12/10-things-you-might-not-know-about-using-css/
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 24478848
Just a gentle reminder. It's been two weeks since you indicated that your questions were answered on this post. Time to assign points please :)

dday
0
 

Author Closing Comment

by:shinnmill
ID: 31581234
Sorry about the delay - I'm suffering a bit from sleep deprivation!  Thanks for all the help, I really appreciate it.  I'm learning, but right now, know just enough to be dangerous.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS auto-height of empty div 3 68
Telerik RadEditor Control Save 8 39
Need help with FaceBook login 2 41
isNaN issue on the Table input text 2 41
This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question