Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Reid
19,691 PointsCentre Nav Bar
Hi! I am embarking on my first project as a freelancer and I am creating a store on wordpress and woocomerce. I am using a starter theme called _tk
I just can't seem to be able to centre the nav bar in the middle. Any help would be appreciated. Thanks
The website is http://exhibit.brightideadesign.net/
1 Answer
Mark Truitt
17,230 PointsHi David,
On the ul id main-menu remove the float left and add display block and margin: 0 auto. Then on the li's remove the float left and make them inline-block.
David Reid
19,691 Points#main-menu {
float: none;
display: block;
margin: 0 auto;
}
#main-menu > li {
float: none;
display: inline-block;
}
is this the idea Mark? Can't seem to work it out. Thanks for the help
Mark Truitt
17,230 PointsSorry about that David. Text align center on the #main-menu and it needs to be block. It is currently set as inline-block. Margin: 0 auto isn't really required but would center the UL if something else forced a width change. You can remove that if there are no chances it will change.
David Reid
19,691 PointsThank so much mark! Appreciate it!
David Reid
19,691 PointsDavid Reid
19,691 Pointsthis is the css I tried