Reputation: 73
I have a button that has only one letter in it. this is the HTML for it:
<button type="button" class="clicker">X</button>
I need to resize that button to make it smaller as much as I need, and also to keep that letter following the size of the button.
I have tried the following css andit resizes the button, but the text is not following. It is either at the bottom of the button or not visible at all.
.clicker {
float: right;
font-family:"Calibri",Arial,Sans Serif;
font-size:1.0em;
line-height: 30px;
color:red;
text-align: center;
wordwrap: center;
text-shadow:1px 1px 1px #FFFFFF;
width: 30.0px;
height: 25.0px;
}
Upvotes: 2
Views: 100
Reputation: 10179
It's just becuase of your line-height
. Remove it and it works :)
CSS:
.clicker {
float: right;
font-family:"Calibri", Arial, Sans Serif;
font-size:1.0em;
color:red;
text-align: center;
wordwrap: center;
text-shadow:1px 1px 1px #FFFFFF;
width: 30.0px;
height: 25.0px;
}
Upvotes: 0
Reputation: 80639
I don't think you need font-size
and line-height
properties. Use vertical-align
instead.
.clicker {
font-family: "Calibri", Arial, Sans Serif;
font-size: 1.0em;
color:red;
text-shadow: 1px 1px 1px #FFFFFF;
width: 30px;
height: 25px;
vertical-align: middle;
}
Fiddle:- http://jsfiddle.net/7wCLu/
Upvotes: 0