homepage Welcome to WebmasterWorld Guest from 54.166.173.147
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
centering a Button
How do i do this?
choodie




msg:4595312
 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




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

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




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

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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved