Forums

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

Home Forums CSS Need help to centre my CSS Navigation Bar

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #45075
    JtB
    Member

    Hi Guys, I am new to this site and I am stuck on trying to centre my CSS navigation bar and centre the text, like the navigation bar I created on this website here: http://wrapsandtints.co.nr

    Here is my current website and navigation bar that needs updating to look like the one above:
    http://wrapsandtints.eu.pn/

    Thanks very much for your help.

    JtB

    #136171
    JohnMotylJr
    Participant

    @JtB Are you content with using tables to structure your code?

    #136173
    JtB
    Member

    Yes, the navigation bar is placed inside a table.

    #136174
    Paulie_D
    Member

    The best option is to use inline block instead of tables (the worst option) or floats.

    http://joshnh.com/2012/02/07/why-you-should-use-inline-block-when-positioning-elements/

    Here’s an example with a sub level included : http://codepen.io/Paulie-D/pen/86731daa8998d3df818160b9df55d6d9

    #136175
    JtB
    Member

    Thanks Paulie, is there no line of code I can use to just centre the CSS Navi bar I already have in the table?

    Thanks

    #136177
    JtB
    Member

    Nevermind, solved it now. Thanks for your help guys!

    #136178
    Paulie_D
    Member

    Nope…not really.

    You could give the `ul` width..say the same as the table (938) which will extend the menu and it will, therefore be centered but that won’t center the list items.

    Other than that you could set a left margin on the ul (say 69 px [938 -800]/2) but that would be rally hacky and not ideal

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