Forum Moderators: not2easy

Message Too Old, No Replies

centering a button

         

Crump

6:06 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



.button {
font-family : Verdana;
font-size: 0.6em;
font-weight: bold;
color: #FFFFFF;
margin: 0px auto;
background: #000000;
}

why isn't this centering?

Fotiman

6:29 pm on Mar 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Probably because whatever you're assigning this class to is an inline element instead of a block element. If you add display:block to the style rules, it will be centered.

Crump

6:49 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



Thanks, that worked. I am still new to CSS and I always forget about the display: block / inline function.

Thanks again.