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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...