Skip to content
This repository has been archived by the owner on Jan 14, 2019. It is now read-only.

Center text on Navbar #104

Open
tannercurey opened this issue Nov 15, 2017 · 5 comments
Open

Center text on Navbar #104

tannercurey opened this issue Nov 15, 2017 · 5 comments

Comments

@tannercurey
Copy link

tannercurey commented Nov 15, 2017

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
Copy link

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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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

@JustineEvansUM
Copy link
Member

Fantastic! Glad it worked!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants