Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

IE/Firefox margin issue - Baffled!

Featured Replies

Hi all,

 

I've been working on this site (netcitydesigns.co.uk) for a short while, updating bits as I go. Now, I added in a jQuery image-rotating header last night at the request of my buddy and it seems to have created a margin error in the header that I just can't find. In Chrome and Safari the header is the right hight (178px) but in IE (8 and 9 I've checked) and Firefox the rotator images spill out from underneath the header DIV by 1 - 3px.

 

Basically, it's an outer DIV with two inner DIVs stacked on on top of the other with the logo and nav DIVs floated within the top DIV. I've tried stripping it back to bare bones and still can't explain it.

 

Little help? (Please be gentle, I'm still learning!)

 

Here's the header HTML and CSS:

 

<div class="head_wrap">

   <div class="rotator">
       <ul>
               <li class="show"><img src="images/notts_1.png" width="940" height="178" alt="pic1" /></li>
               <li><img src="images/notts_2.png" width="940" height="178" alt="pic2" /></li>
               <li><img src="images/notts_3.png" width="940" height="178" alt="pic3" /></li>
               <li><img src="images/notts_4.png" width="940" height="178" alt="pic4" /></li>
       </ul>  
   </div>

   <div id="header" class="group">

       <div id="logo">
           <h1 class="bold">NAME</h1>
           <h1 class="light">NAME</h1>
           <h2>MASTHEAD</h2>
       </div> <!-- end logo -->

       <div id="nav">
           <ul>
               <li><a href="#_top">Home</a></li>
               <li class="nav_hide"><a href="#_top">About</a></li>
               <li class="nav_hide"><a href="#_top">Portfolio</a></li>
               <li class="nav_hide"><a href="#_top">Contact</a></li>
           </ul>
       </div> <!-- end nav -->

   </div> <!-- end header -->

</div <!-- end head_wrap -->

 

.head_wrap {
   margin-bottom: 40px;
}

/* rotator in-page placement */

div.rotator {
position: absolute;
margin-left: 0px;
display: none;
       z-index: 0;
}

/* rotator css */

div.rotator ul li {
float:left;
position:absolute;
list-style: none;
}

div.rotator ul li.show {
z-index: -1;
}

/* header */

#header {
   position: relative;
   border-bottom: 1px solid rgb(132,132,132);
   z-index: 2000;
}

#logo {
   float: left;
   margin-top: 30px;
   margin-left: 20px;
}

#logo h1 {
   font-size: 3.125em;
   line-height: 0.8em;
}

#logo h2 {
   border-top: 1px solid rgb(132,132,132);
   margin-top: 15px;
   padding-top: 5px;
}

/* navigation */

.nav_hide a {
   visibility: hidden;
}

#nav {
   float: right;
   width: 110px;
   padding: 10px 0 10px 0;
   font-size: 1.25em;
   background-color: rgba(255,255,255,0);
}

#nav li {
   border-top: 1px solid rgba(132,132,132,0.5);
}

#nav li:last-child {
     border-bottom: 1px solid rgba(132,132,132,0.5);  
}

#nav a {
   display: block;
   text-align: right;
   padding: 10px 20px 10px 0;
}

#nav a:hover {
   background-color: rgba(255,255,255,0.2);
   -webkit-transition: background-color .15s linear;
   -moz-transition: background-color .15s linear;
   -o-transition: background-color .15s linear;
   transition: background-color .15s linear;
}

You have an unclosed div tag on line 54

 

</div <!-- end head_wrap -->

 

Fix this first and get back if you still have the problem

Edited by oakleaves

  • Author

Thanks, oakleaves. I fixed that (and took out the height: 100% from the body element) but the problem is still there.

 

Thoughts?

What Phunk says. Sometimes you have to be quite strict and bossy with your CSS code to force the browsers to display elements properly. This is where a CSS Reset may come in handy.

What Phunk says. Sometimes you have to be quite strict and bossy with your CSS code to force the browsers to display elements properly. This is where a CSS Reset may come in handy.

 

Quote for truth, CSS resets are absolutly important and especially when it comes to cross browser compatability.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.