I am trying to create the nav of
http://forrst-production.s3.amazonaws.com/posts/snaps/59125/mega.jpg?1297328693
the nav width will expand or contract according to the width of inner list items. How can I acheive that? or must I set a fixed width for the nav?
You can simply enter the list's address (e.g., ed. The block element (i.e., the list items inline-block) and the nav * text-align center (i.e., the center; *). Inlining-block is used (inline-block; *).
You can move the nav elements to the center by putting text-align:center on the ul because the list elements have been set to inline-block which means they can be centred in the same way that you can centre text.
Just give the list centered text (e.g. ul. nav { text-align: center; } ) and the list items inline-block (e.g. ul. nav li { display: inline-block; } ).
display: flex; justify-content: center; Will center your navbar, if you remove the width: 100% and the float: left . Show activity on this post. Give display:inline-block to li and text-align:center; padding:0; to ul tag.
Make each item and the ribbon ends display:inline-block
, then use text-align:center
on the parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With