The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Margin auto

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #148284

    Hello folks,

    Im trying to figure out how to center the site’s navigation in the center of the .grid_12 div for the past 2h. It all works just perfect, its just I have to have that menu to display in the middle. I tried text-align: center as well as margin: 0 auto; on different rules in the navigation. Was thinking it might be because Im using the grid perhaps, anyhow Im not sure about it. Can some of you forumees point me to the direction please.

    Many thanks.

    Here’s the fiddle


    There’s a few rules to centering a list.

    If you give something a fixed width, you can use margin: 0 auto;.

    But giving a width limits things a little, so you’ll probably want to give it more flexibility. In that case, you can set text-align:center; on the UL, but you’ll have to make sure that no items within the UL are block-level elements or floated! So make the LI inline elements (or inline-block) and remove the display:block from the links inside the LIs.



    Dear Senff, thank you very much.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.