Reply LinkBack Thread Tools Search this Thread
Old 29-01-2007, 20:53   #1 (permalink)
pojo
Registered User
 
Join Date: Jan 2007
Posts: 6
question about horizontal css list navbars

currently, i'm trying to get a horizontal css navbar working, and i'm having problems

the li tags are styled as display:inline, and as far as I know, you can't set a height for inline elements, right? so how do i set the height of a css navbar without fidgeting with the margins?
  Reply With Quote
Old 29-01-2007, 20:58   #2 (permalink)
Drewry
Senior Member
 
Drewry's Avatar
 
Join Date: Jan 2007
Location: Alabama, USA
Posts: 298
Send a message via Skype™ to Drewry
Quote:
<style>
#test ul {
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}
#test li {
display: inline;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}
#test a:active, #test, a:link, #test a:visited {
display: block;
width: 100px;
height: 80px;
line-height: 80px;
background-color: #000;
color: #fff;
text-size: 12px;
font-family: Verdana;
}
#test a:hover {
background-color: #fff;
color: #000;
}
</style>
<div id="test">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
</ul>
</div>

Just quickly typed that up, but it SHOULD work.
  Reply With Quote
Old 29-01-2007, 21:01   #3 (permalink)
pojo
Registered User
 
Join Date: Jan 2007
Posts: 6
thanks, that worked

except now the boxes are vertical...

do I have to make them into floats to make them horizontal?
  Reply With Quote
Old 29-01-2007, 22:08   #4 (permalink)
gkwinspired
Come on IE - GO GECKO!
 
gkwinspired's Avatar
 
Join Date: Jan 2007
Location: Wasilla, Alaska
Posts: 93
yep...unfortionatley you do!

On another note - do you have the "Web Developer" plugin for firefox. It makes situations like this really easy. It allows you to make changes to the CSS within the browser and it automatically updates it.

--
Greg
  Reply With Quote
Old 29-01-2007, 22:42   #5 (permalink)
pojo
Registered User
 
Join Date: Jan 2007
Posts: 6
for some reason, I just can't get the boxes to be horizontally next to each other in firefox 2 =/. i tried setting everything to float:left, but to no avail

can someone please help
  Reply With Quote
Old 29-01-2007, 22:57   #6 (permalink)
gkwinspired
Come on IE - GO GECKO!
 
gkwinspired's Avatar
 
Join Date: Jan 2007
Location: Wasilla, Alaska
Posts: 93
I think that it is the display settings - check out this site:
http://www.quirksmode.org/css/display.html

--
Greg
  Reply With Quote
Old 30-01-2007, 00:46   #7 (permalink)
skyrocket
SkyRocket Design
 
skyrocket's Avatar
 
Join Date: Aug 2005
Location: Chichester
Posts: 538
Drewry version (remix)...

#test ul {
float: left;
width: 100%;
padding-left: 0;
margin-left: 0;
background-color: #036;
color: #fff;
}
#test ul li {
display: inline;
}
#test ul li a {
float: left;
padding: 0.2em 1em;
background-color: #036;
color: #fff;
text-decoration: none;
border-right: 1px solid #fff;
}
#test ul li a:hover {
background-color: #ce4;
color: #f90;
}

<div id="test">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
</ul>
</div>

that will work in Firefox
  Reply With Quote
Old 30-01-2007, 02:39   #8 (permalink)
emil
dt immigrant
 
emil's Avatar
 
Join Date: Nov 2004
Location: Bucharest - Romania
Posts: 6,971
Send a message via ICQ to emil Send a message via MSN to emil Send a message via Yahoo to emil Send a message via Skype™ to emil
__________________
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8