| Strange space after list item
|
greencode

msg:4278438 | 5:42 pm on Mar 8, 2011 (gmt 0) | Can't quite figure out why I'm getting a margin of around 4 pixels to the left of each list item in this code?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title></title> <style type="text/css"> <!--
.nav-bar ul { list-style: none; }
.nav-bar ul li { display: inline; }
.nav-bar ul li a { border-right: 5px solid #000; } --> </style> </head> <body> <div class="nav-bar"> <ul> <li class="list"><a href="#">List</a></li> <li class="map"><a href="#">Map</a></li> <li class="grid"><a href="#">Grid</a></li> </ul> </div> </body> </html>
Any help would be greatly appreciated - I'm sure I'm just being very silly!
|
birdbrain

msg:4278455 | 6:47 pm on Mar 8, 2011 (gmt 0) | Hi there greencode change display:inline to float:left. ;) birdbrain
|
greencode

msg:4278539 | 10:57 pm on Mar 8, 2011 (gmt 0) | Thanks so much for this. I seem to alternate between floating and displaying! Obviously depending on the rest of the rest of my layout - if I don't use floats should I then just add a display: inline-block; to the ul? So, the final code to read as: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title></title> <style type="text/css"> <!-- .nav-bar ul { list-style: none; display: inline-block; } .nav-bar ul li { float: left; } .nav-bar ul li a { border-right: 5px solid #000; } --> </style> </head> <body> <div class="nav-bar"> <ul> <li class="list"><a href="#">List</a></li> <li class="map"><a href="#">Map</a></li> <li class="grid"><a href="#">Grid</a></li> </ul> </div> </body> </html>
|
|
|