navigationbar - What is the minimal css for a navigation bar -


with advent of 'nav' tag i'm revisiting creation of navigation bar. there many tutorials take different approaches , cloud issue css.

specifically, have 960 width content area , want centre nav buttons within this.

  1. does 'nav' element have inherent css-behaviour, or purely semantic-container?
  2. if i'm centre-ing buttons surely don't need 'float' them? text-align, centre ul should trick.
  3. if want buttons shorter nav-bar itself, should give bar height (using line-height buttons centre them) or add margins buttons push bar outwards (vertically)?

here's fiddle few examples: http://jsfiddle.net/joplomacedo/ejsby/

does 'nav' element have inherent css-behaviour, or purely semantic-container?

the nav element purely semantic container. in terms of css behaves nothing more simple block level element div.

if i'm centering buttons surely don't need 'float' them? text-align, center ul should trick.

if you,re using ul, you're saying do, you'll need li's too. problem li's have display of block (actually, not block - list-item. in ways we're interested in, behave block though) - , when want put block level elements side side, you'll either need float them, or change display inline (inline-block).

either 'floats', or 'inline-blocking'. tend prefer using "inline-block technique" many reasons - 1 of them that, centering blocks, want to, matter of setting text-align center on parent element.

if want buttons shorter nav-bar itself, should give bar height (using line-height buttons centre them) or add margins buttons push bar outwards (vertically)?

it seems simpler add padding-top & bottom nav block, doesn't it?

so again, here's fiddle: http://jsfiddle.net/joplomacedo/ejsby/


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -