Forums

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

Home Forums CSS Having a hard time centering my nav bar!

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40722
    calum
    Member

    Hi there,

    Got a very amateur problem going on that I can’t seem to find a remedy for.

    Essentially, all I want to do is force my horizontal nav bar into the center – everything I’ve tried has failed to do this.
    If I can, I also want to fix its position. (Might be a problem while centering it?)

    Here’s the code I currently have: http://codepen.io/anon/pen/napGz

    Any help would be appreciated! As I say, I’m an amateur but I can’t find anything to get this working!!

    #113898
    calum
    Member

    My girlfriend pointed out that the HTML tag ‘center’ exists. -_-

    #113899
    Manojnaanak
    Participant

    ul{text-align:center}

    #113900
    Paulie_D
    Member

    You can set

    ul {
    margin-left: auto;
    margin-right:auto;
    }

    BUT you have to give the ul a width for it to work. A % width or specific px width will do.

    http://codepen.io/anon/pen/xsvwG

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