Answer the question
In order to leave comments, you need to log in
How to cross-browser and cross-platform align text vertically (fonts)?
It seems that the question is hackneyed and resolved long ago, but again put me in a dead end.
For example, there is a div-button with an inscription in the middle. To center it we write in styles:
.button{
height:30px;
line-height:30px;
padding:0 20px;
font-size:16px;
font-family:'PT Sans',Helvetica,Arial,sans-serif;
/*стили для придания прочей красоты*/
}
Answer the question
In order to leave comments, you need to log in
IMHO, there is nothing wrong with such behavior on different browsers and sawing hacks, as it is not elegant. To determine the version of the browser and give it your own - well, too, somehow ....
Perfectionism is good, but in moderation.
Otherwise, you can find fault with the different rendering of fonts on Windows, Lin and Mac, with different interpretations of the letter-spacing property, etc.
Use a set of hacks for problematic browsers, and the corresponding css rules in them that fix the problem.
Also, in cases where line-height did not help, the centering method through padding helped (a little less on top, a little more on bottom). The stability of this method, according to my observations, is higher.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question