This is my code:
#homeButtonText{
font-size: 25px;
text-align: center;
}
How do I get the text on the inside to be right in the center.
I have tried,
vertical-align: middle;
with no success. Any help is appreciated!
This is my code:
#homeButtonText{
font-size: 25px;
text-align: center;
}
How do I get the text on the inside to be right in the center.
I have tried,
vertical-align: middle;
with no success. Any help is appreciated!
have you set height to your div? You can use line-height
Check this here: demo
Solutions:
FIRST - QUICKEST:
set line-height:(button height)
to the #homeButtonText
SECOND - RECOMMENDED
use padding, like this:
padding:10px 20px;
so the text will be in center and you will have full control
You could use display: table-cell
and vertical-align: middle
.button {
background: #DDDDDD;
width: 200px;
height: 80px;
display: table-cell;
text-align: center;
vertical-align: middle;
}
a {
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
color: #000000;
}
<div class="button"><a href="#">Home</a>
</div>
Have you tried positioning the text absolutely inside the div?
Something like:
top:50%;
left:50%;