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.

Navigation Menu - Wonky spacing

Featured Replies

Hi,

 

I have been trying to implement a drop down menu on the site I am working on. I am ALMOST there, but I have a problem with the spacing of the navigation menu items. They are not spaced equally, and in IE, the last item "Corporate & Promotional Gifts" breaks onto 2 lines.

 

Take a look here:

 

http://is.gd/89hA

 

I am thinking that if I could make the spacing smaller and make it equal between each item then all would be fine... but I am a bit lost, and have been experimenting, so may have messed things up somewhat!

 

Hope some CSS gurus out there can help!! Thanks in advance...

 

The CSS is here:

 

#nav {
padding: 0;
margin: 8px 0 8px 45px;
list-style: none;
}

#nav ul a {
padding: 10px 0 6px 6px; 
}

#nav a {
display: block;
width: 15em;
color:#fff;
text-decoration:none;
}

#nav li a:hover, #nav a:active {
color: #F64337;
}

* html #nav a { 
width: 8em;
}

#nav li {
float: left;
width: 8em;


}

#nav li ul {
position: absolute;
width: 15em;
left: -999em;
background: #000;
padding: 0 0 3px 0;

}

#nav li:hover ul, #nav li.sfhover ul{
left: auto;
}

Just took a quick look

 

#nav li {
float: left;
width: 8em;
}

 

... is fixing the width of each top level nav link so if the text is too long it starts wrapping, try setting the width to auto?

  • Author
Just took a quick look

 

#nav li {
float: left;
width: 8em;
}

 

... is fixing the width of each top level nav link so if the text is too long it starts wrapping, try setting the width to auto?

 

Thanks Rob,

 

I'm afraid that just makes the spacing massively wide (see screenshot). The reason I am having to specify widths is, I think, to do with getting the drop-down menu to work properly in certain browsers. I followed a guide here to do the drop-down menu and I think this is where the problems have sprung from!

 

post-2184-1227118079_thumb.png

Hi,

 

floated horizontal menus are a pain to code for all browsers.

 

see http://www.cssplay.co.uk/menus/final_drop.html for a drop-down horizontal menu that works everywhere. As an added bonus it doesn't use javascript. View source to see how it's done. The CSS is inline and commented...

 

If you want a drop down that does use javascript, the best I've found is Superfish

  • Author

Thanks very much Sameer, I will check those out. The one I am trying to implement is based on Suckerfish, probably similar to Superfish.

 

In the meantime, if anyone can spot anything fundamental I may be doing wrong, I would welcome any feedback. Cheers!

see http://www.cssplay.co.uk/menus/final_drop.html for a drop-down horizontal menu that works everywhere. As an added bonus it doesn't use javascript. View source to see how it's done. The CSS is inline and commented...

 

That is brilliant - I have been looking for something like that.

 

I do so many browser fixes on DDs like that!

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.