Nelson Tan Posted December 8, 2017 Share Posted December 8, 2017 (edited) Hi, in this hover dropdown menu example (https://www.w3schools.com/howto/tryi...ropdown_navbar), the menu words are aligned left starting from 'Home'. Where do you place the 'text-align: center' statement in the coding to shift all the words towards the center of the navigation bar? Somehow it isn't as simple as it seems to me. For your benefit, I attach sample coding in example.html. Thanks for your advice. example.html Edited December 8, 2017 by Nelson Tan Link to comment Share on other sites More sharing options...
Ingolme Posted December 8, 2017 Share Posted December 8, 2017 Since they use the float property text align has no effect. To center the menu you will have to remove the float property and set the display of the menu items to inline-block. Then you can use text-align on the container. Link to comment Share on other sites More sharing options...
Nelson Tan Posted December 8, 2017 Author Share Posted December 8, 2017 Hi Ingolme, thanks for replying. I'm almost there. Right now, the non-dropdown words and the dropdown words do not align vertically. Can you or anyone please take a look at the attachment example2.html? Thanks. example2.html Link to comment Share on other sites More sharing options...
dsonesuk Posted December 8, 2017 Share Posted December 8, 2017 https://www.w3schools.com/code/tryit.asp?filename=FM0L3K29DJO4 Link to comment Share on other sites More sharing options...
Nelson Tan Posted December 8, 2017 Author Share Posted December 8, 2017 Hey thanks, dsonesuk. Problem solved. Have a good weekend. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now