I am trying to find the most elegant way to center text in an anchor tag, and have already googled for answers but couldn’t find something that really fits my design principals.
In general I like to only specify a number once, so that if I have to change it later on I only need to change one place. In programming this is very easily done, but with css, if I set the div height to 50px, I don’t want to set the anchor height and line-height also to 50px just to center the text
<div><a>this is a test</a></div>
[style]
div{
height: 50px;
}
a{
height: 100%;
}
[/style]
Thanks a lot! I think I will go with table for now, just in case the user browsers don’t support. In the future when older browsers become more obsolete will switch to flexbox.