Jump to content
MARCELO

How to center a buttom

Recommended Posts

The anchor by default is INLINE, it has also has the property of display: inline-block; both of these means it will act as text would behave in a BLOCK paragraph element that has text-align: center;

The margin: 0 auto; only works on BLOCK elements that are not floated and have a width that is smaller than the parent BLOCK element.

Edited by dsonesuk

Share this post


Link to post
Share on other sites

Use html tag <center></center> as shown below to get it  done easily or you can redefine its css property as display block and then margin auto.

<center><a class="button" href="#"><span>GO! </span></a></center>

Share this post


Link to post
Share on other sites

No one ever uses center tag anymore in preference for css, also its not supported in HTML5, also to centre a block element with margin auto, a width is required.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×