Media-Ed-Online / intro-web-dev-2017aut

Site for course "Introduction to Web Design and Development."
https://media-ed-online.github.io/intro-web-dev-2017aut/
MIT License
12 stars 3 forks source link

Center text on Navbar #104

Open tannercurey opened 6 years ago

tannercurey commented 6 years ago

I just can't figure out how to get my link buttons on the navbar "Home, About, Contact" to be on the center of the Navbar below the page title. I've tried to center everything with my CSS style page for the navbar and i've ever tried to simply use "center" but nothing seems to work. Anybody have any ideas?

Here's my page

MarkLannen commented 6 years ago

I don't know if this will work, but I set a width at 100%, and then used the following css for the nav items.

{margin-top: 0; margin-bottom: 0; margin-left: auto; margin-right: auto;}

Shorthand for this would be: {margin: 0 auto;}

Assuming you don't need a top or bottom margin (you can change that if needed), auto for left and right should center the menu items.

Let me know if this helps!

tannercurey commented 6 years ago

Thanks for the help Mark, I appreciate your time. I finally got around to trying this but still can't quite figure it out. I'm not unhappy with the way my navbar looks so it's not a major issue right now, I was mostly just curious how I could center the text on it.

JustineEvansUM commented 6 years ago

Hey @tannercurey! Awesome site. You need to move some information around. You actually have a wayward float value that's giving you headaches.

Remove the float from your li {} attributes, and attach a display: inline-block to get a similar appearance, but with better control:

li {
    /*float: left;*/
    text-align: center;
    display: inline-block;
}

li a {
    display: inherit;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

Try it and let me know what happens!

tannercurey commented 6 years ago

Awesome! Thank you @JustineEvansUM, that worked perfectly! Now that's what I was going for, I appreciate it!

JustineEvansUM commented 6 years ago

Fantastic! Glad it worked!