Another CSS Headache... a big one!

This is a discussion on "Another CSS Headache... a big one!" within the Web Page Design section. This forum, and the thread "Another CSS Headache... a big one! are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 8th, 2006, 22:42
New Member
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Another CSS Headache... a big one!

Hi everyone.

As you can probably gather from looking at my previous posts, I'm developing with CSS for the first time... and encountering all sorts of difficulties! Though all up to now have been solved by the kind people of this forum.

The latest headache is because of the following:

I have a <div> called "navMain" in which I want to display a row of list items (text anchors). Because this <div> sits on top of a background, the positioning of the inline list is important. The XHTML code for the <div> and list is as follows:

Code: Select all
        
<div id="navMain">
     <ul id="navList">
       <li><a href="aboutUs.html">  ABOUT US  </a></li>
       <li><a href="ourSmiles.html">OUR SMILES</a></li>
       <li><a href="services.html">  SERVICES   </a></li>
       <li><a href="faq.html">        FAQ           </a></li>
    </ul>
  </div>
I played about with the CSS for a few hours, and got the inline list along with the CSS rollover effects looking wonderful... in IE. However, when I viewed it in other browsers (Netscape, Firefox, Opera), the darn list appears much lower down the <div>. Nightmare.

I've stripped my code down to the bare essentials to try and solve the problem, yet still can't fathom it out.

I've included two screen shots to illustrate this. The ieDisplay screen grab (from IE) shows the links (in blue) at the very top of the navMain <div>, whilst the nnDisplay screen grab shows the same webpage viewed in Netscape - notice the links are further down the <div>... NIGHTMARE!

Here's the CSS that controls the navMain <div> and the list.

Code: Select all
#navMain
{
  width: 496px;
  height: 289px;
  padding:0px;
  margin:0px;
  float: right;
}
 
#navList ul, #navList li
{
  margin: 0;
  padding: 0;
  display: inline;
  list-style-type: none;
  font-size: 12px;
  font-weight: bold;
}
I would be very extremely grateful if anybody could have a look at this and help me out in trying to find the answer for this cross-browser difference, and a solution as to how to display the list the same across all browsers.

Many thanks in advance.
Attached Images
File Type: gif ieDisplay.gif (40.7 KB, 58 views)
File Type: gif nnDisplay.gif (41.0 KB, 48 views)
Reply With Quote

  #2 (permalink)  
Old Apr 9th, 2006, 17:40
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to herkalees Send a message via MSN to herkalees Send a message via Yahoo to herkalees
Re: Another CSS Headache... a big one!

Old:
#navList ul, #navList li
{
margin: 0;
padding: 0;
display: inline;
list-style-type: none;
font-size: 12px;
font-weight: bold;
}

--------------------

New:
ul#navList
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 12px;
font-weight: bold;
}

ul#navList li
{
margin: 0 5px 0 5px;
padding: 0;
float: left:
}



What you had was CSS saying "All <ul>s that are a child of anything called id=navList". But, your <ul> itself was called navList, not anything below it.

My new CSS up there might not achieve your exact desired result, but play around with the declared margin and padding numbers, you'll be a lot closer now.
Reply With Quote
  #3 (permalink)  
Old Apr 17th, 2006, 12:16
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another CSS Headache... a big one!

Or put an id in your <li> tags. I'd use a class personally.
But Herk's way is better, IMO.
Reply With Quote
Reply

Tags
css, headache, big

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help please! Headache. Bravo81 Search Engine Optimization (SEO) 16 Jan 24th, 2008 10:26
[SOLVED] Doctypes and CSS Headache Jenski Web Page Design 3 Jan 17th, 2008 07:30
Directory headache Rudi Starting Out 4 Mar 30th, 2007 09:06
Design headache: Best way to integrate floating links? Rezl Web Page Design 1 Aug 4th, 2006 19:24


All times are GMT. The time now is 03:02.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43