How to center blocks in HTML
Go to solution
Solved by Mr_KoKa,
Go to what you had at first post and change float: left; to display: inline-block; and then adding text-align: center; to ul will make list items centered.
float: left makes all elements pulled to the left.
display: inline-block makes elements able to display one after another and you can still set width and height, if it would be just inline, you would need to set padding to enlarge element. text-align affects only inline elements (including inline-block)
But, you can use just one div and links inside it to create exactly same effect, example: https://jsfiddle.net/w34uurra/
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