Trick_Master990 Posted July 9, 2015 Share Posted July 9, 2015 Hey, I'm optimizing my old CSS and HTML code and now I have trouble of centering list of buttons. Here's the fiddle: http://jsfiddle.net/f5w1dbbz/ I already tried wrapping the list and use text-align: center but it still doesn't work. I only get it to work by using position: relative and centered it manually. Do you have any other idea? Link to comment Share on other sites More sharing options...
dsonesuk Posted July 9, 2015 Share Posted July 9, 2015 (edited) http://jsfiddle.net/f5w1dbbz/1/ If float is used it will override text-align: center; the old method was to use position: relative; using my example on nav and ul element with ul using float: left; nav would then use left: 50% which would force it and ul left edge right to be in dead centre. Then because ul is floated its width is determined by content, so you then force ul 50% of it length back left using left; -50%;, but with display: inline-block; it became more easy. Edited July 9, 2015 by dsonesuk 1 Link to comment Share on other sites More sharing options...
Trick_Master990 Posted July 9, 2015 Author Share Posted July 9, 2015 Many thanks! 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