Welcome to WebmasterWorld Guest from 54.226.130.194

Forum Moderators: not2easy

Message Too Old, No Replies

centering a Button

How do i do this?

     

choodie

11:48 am on Jul 22, 2013 (gmt 0)



hi
im trying to centre a button and i can't get it to work for me. I'd appreciate some input as to how i could do this.
My page width is 920px
the html is as follows
<button><a class="pricebutton" href="price.html" title="pricelist">Find our Pricelist Here<button>

the CSS
a.pricebutton {
display: inline-block;
margin-left: auto;
margin-right: auto;
text-align: center;
color: white;
}

I have tried text-align: center i have tried display block. i just want it to sit in the middle of my page

thanks in advance

lucy24

4:28 pm on Jul 22, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



What are you trying to center? The button or the <a> within the button? The CSS only applies to the <a> element; it says nothing about <button>.

Fotiman

4:49 pm on Jul 22, 2013 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



That markup is also invalid.
1. You can't have an <a> within a <button>
2. You didn't close the <a> with a </a> before the closing </button>

choodie

10:36 pm on Jul 22, 2013 (gmt 0)



thanks guys elementery mistakes im just a beginner. its all good now.