css block inside of inline

css block inside of inline

phoenix_r

2009 May 13 • 905
17 ₧
Sooooo I have something like this:
code

<div style="min-width:780px;max-width:1260px;">
<ul class='navbar'>
<li><a href="#">hella content</a></li>
<li><a href="#">hella content x 2</a></li>
<li><a href="#">hella content x 420</a></li>
<li><a href="#">made you look</a></li>
<li><a href="#">duck duck content</a></li>
<li><a href="#">put that in your stuff and smoke it</a></li>
</ul>
</div>


I have
code
li{display:inline;}
and I want the six 'buttons' to divide up the horizontal width minus a bit of margin between themselves evenly, and cannot seem to get this right. I've tried setting
code
.navbar a{display:block;width:16.5%;)
but it didn't work. Any thoughts? Thanks!


BOO
 
 
 
2011 Jun 22 at 20:12 UTC
phoenix_r

2009 May 13 • 905
17 ₧
Ended up skipping the display styling and just floating the little cocksuckers. It works, but I'd still be interested to hear how I might have gotten the above to work.
BOO
 
 
 
2011 Jun 22 at 22:52 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
I don't believe it is possible unless the total space is fixed width.

There's no way to convince [all] browsers that the percentages are intended to add up to 100%, and more importantly, that the pixel-widths are supposed to add up to some total.

Let's say the total width is dynamic and at the moment it is 904px and you have 5 buttons, for a clean 20% each.

Well 20% of 904px is 180.8 pixels so each button is probably going to be 181px. But that adds up to 905px. Basically you are depending on the browser to magically pick one to short by a pixel.

Some browsers actually do this. But not all of them.

Because really, who says you even want it to add up to 100%? Browsers have to just kind of guess.

I always give up and use a dirty, nasty table.
 
 
 
2011 Jun 23 at 06:31 UTC — Ed. 2011 Jun 23 at 06:33 UTC
phoenix_r

2009 May 13 • 905
17 ₧
The corpse of semantic markup is rolling over in its metaphorical grave, Supes...fuck it, tables it is. I suppose I should probably lighten up, it's the 90's after all...

EDIT: Forgot to say thanks! Maybe when you die, you can be the corpse of semantic markup!
BOO
 
 
 
2011 Jun 23 at 15:48 UTC — Ed. 2011 Jun 23 at 15:49 UTC
Page [1]