Reputation: 335
I have a button and I want it to be a particular size
html
<a class="button icon Raise"
onclick="raiseButtonAction(realPlayer, gameState)" id="nupp1" href="#"><span>RAISE</span></a>
css
.button {
position: absolute;
border-top: 1px solid #96d1f8;
background: #65a9d7;
background: -webkit-gradient(linear, left top, left bottom, from(#3e779d),
to(#65a9d7) );
background: -moz-linear-gradient(top, #3e779d, #65a9d7);
padding: 5px 10px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: rgba(0, 0, 0, 1) 0 1px 0;
-moz-box-shadow: rgba(0, 0, 0, 1) 0 1px 0;
box-shadow: rgba(0, 0, 0, 1) 0 1px 0;
text-shadow: rgba(0, 0, 0, .4) 0 1px 0;
color: white;
font-size: 19px;
font-weight: bold;
font-family: Segoe;
text-decoration: none;
vertical-align: middle;
But if I put for example width:100px; it doesn't change in size. Am I doing something wrong or you just can't change the size of a premade button?
Upvotes: 8
Views: 56965
Reputation: 6469
You need to make your <a> into a block level element. Here's an example of it working.
I just added this to your CSS for .button:
display: block;
width: 200px;
text-align: center;
Upvotes: 3
Reputation: 2963
That style is on an a
element, which is an inline and won't accept a width. You could change it to be inline-block
or block
and then you'll have control over the width.
Upvotes: 8
Reputation: 23054
Try this..
.button {
display:inline-block;
min-width: 50px;
width: 80px;
padding:5px 10px;
}
Upvotes: 12
Reputation: 5720
Missing
display: block;
Have to set display to block if you want to set a fixed width on an inline element
Upvotes: -1