WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > gaps in my nav

Reply
  Thread Tools Display Modes
Old 15th June 12, 09:36 AM   #1
martinrtr
WLC Member
 
Join Date: Jun 2012
Location: London
Posts: 4
Default gaps in my nav

Hi - can anyone help with pesky gaps between the nav items here:

http://www.carrdale.com/fuller/index.html

I have tried zero'ing margins and padding in the <li> and <a> tags in all possible combinations without any luck. I want the rollover transparent white background to extend left and right to touch the pipes (thats' |) but something appears to pushing the <li> block away from them.

Ok here's the markup:

<div id="nav">

<ul class="zeroOut listNone txtWhite">
<li><a href="index.html">home</a></li>
<li>|</li>
<li><a href="fullerBiog.html">martin fuller</a></li>
<li>|</li>
<li><a href="gallery.html">gallery</a></li>
<li>|</li>
<li><a href="contact.html">contact</a></li>
</ul>

</div>

and here's the relevant styling:

#nav {
height: 95px;
width: 769px;
float: left;
background-image: url(images/navBg.jpg);
background-repeat: no-repeat;
}
#nav li {
display: inline;
text-transform: uppercase;
font-size: 80%;
padding: 0px;
margin: 0px;
}
#nav a {
color: #FFF;
text-decoration: none;
padding-top: 0px;
padding-right: 8px;
padding-bottom: 0px;
padding-left: 8px;
}

#nav a:hover {
color: #660033;
background-image: url(images/navOverBg.png);
background-repeat: repeat;
}
/*navOverBg.png is a 1px square and transparent white)*/

#nav ul {
margin-top: 70px;
float: right;
}

CLASSES:

.zeroOut {
margin: 0px;
padding: 0px;
}
.listNone {
list-style-type: none;
}


.txtWhite {
color: #FFF;
}

Thanks in advance
Martin
martinrtr is offline   Reply With Quote
Old 15th June 12, 11:54 AM   #2
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: gaps in my nav

Your pipe seperator is in a different <li> with whitespace (returns) between them, to where the hover is applied so it never will happen.
chrishirst is offline   Reply With Quote
Old 15th June 12, 11:57 AM   #3
martinrtr
WLC Member
 
Join Date: Jun 2012
Location: London
Posts: 4
Default Re: gaps in my nav

Thanks Chris - I thought of that and tried removing the pipes. I still get a gap between the <li> tags on rollover.

Any ideas?
martinrtr is offline   Reply With Quote
Old 15th June 12, 12:02 PM   #4
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: gaps in my nav

It is not the pipes that needs removing, simply the whitespace

HTML Code:
|<...>|<
Any spacing should be in the element where the :hover is applied
chrishirst is offline   Reply With Quote
Old 15th June 12, 12:08 PM   #5
martinrtr
WLC Member
 
Join Date: Jun 2012
Location: London
Posts: 4
Default Re: gaps in my nav

Sorry but I'm being more than usually stupid here! As far as I'm aware there is no white space in the <li> with the pseudo selector or in the one with the pipe.

My issue put another way is I cannot get ANY background to extend the full length of the <li> tag - whether hover or not. Ie if I just give the <li> a background colour there is still a space left and right before the start of the <li> with the pipe in. I would expect zero'ing out padding and margin to fix this but it doesn't seem to
martinrtr is offline   Reply With Quote
Old 15th June 12, 01:01 PM   #6
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: gaps in my nav

But your :hover is applied to the anchor element NOT the parent <li>.

Anchors <a> are inline elements which will only be as wide as their content makes them.
chrishirst is offline   Reply With Quote
Old 15th June 12, 01:13 PM   #7
martinrtr
WLC Member
 
Join Date: Jun 2012
Location: London
Posts: 4
Default Re: gaps in my nav

Ok - thanks - they trouble is that still doesn't work!

Here's what I did:

#nav li:hover {
color: #660033;
background-image: url(images/navOverBg.png);
background-repeat: repeat;
}

It still doesn't extend the width of the parent element and has the added problem of making the pipes hoverable as well!

I have a vague hunch it's something to do with width - I have tried giving width vales to the <li> but this doesn't help.

Any more ideas - thanks for your help so far BTW
martinrtr is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

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

Forum Jump


All times are GMT. The time now is 03:40 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.