I’m creating a web page (CSS for style) and responsive at computer browser works perfectly and at simulator devices too. The problem came when I open the website at real mobile or TV, that some texts are moved up or down some pixels. Anyone can explain me that? Why is that? The texts are perfectly at middle… Have no sense.
Sorry for my english if I did some mistakes typping.
It does not make sense, for example it does not make sense that a button with padding equal in bottom as in top is not centered. I had checked other cases counting the pixels with Photoshop and they are well positioned.
Image capture on computer on normal screen
Image capture on the computer developer tools to a dimension of 300px width
Image capture in zoom in mobile from 300px to 400px width
HTML Code: <a href="" class="registro">Registrarse</a>
This button does not have any element that changes its appearance, neither in media query css nor anything … If you see that sometimes the background is different, it is because there is a video in the background. This is the clearest example that does not make any sense.
I think the issue has something to do with <a> being an inline element. AFAIK, they do not do vertical padding like block elements do.
I can’t say what I do is best, I usually display as inline-block when I want to display a link differently. But it might be better to use line-height or box-sizing.
One thing I would not do, is the
font-size: 14px;
I use pixel units as sparingly as possible and mainly for borders only.
If you are going to add vertical padding and borders to inline elements then you should instead make them display:inline-block as vertical padding just bleeds out of the current line-height.
You should then set the line-height of the element to make sure that everything is controlled and set the height of the button to match (assuming its non breaking text).
e.g.
Note that depending on browsers and font it may not be possible to always perfectly center the text as browsers add white space to their fonts (half/leading top and bottom) and they have to account for ascenders and descenders which may not all be the same height depending on the glyph etc.
Well, i tryed withut font-size and and what PaulOB said first and nothing continue the same… probably is browser compatibility font as you said, because if i remove font family, it’s not perfect but looks better. Thanks for help guys.
About the vertical-align:baseline; that will keep the button’s text-bottom in level with the outside text on the same line. I.e. in the middle looking at the same font-size.
May I suggest a vertical-align:middle; instead that would keep the button itself at the same level if the button’s font-size changes.
Details, details, I know you are on a phone with a poor connection.
Why not try Verdana or Arial or something else, just so you know it’s not the font your mobile has a problem with?
I can’t detect any difference in e.g. half-lead between your font and common web fonts. It seems to be a clone of Arial, nearly. Then I can’t test on a phone either.
EDIT)
The “HelveticaNeueLTStd-Md” font I tested had the family name “Helvetica Neue LT STD”
Wow i didn’t know about need font stacks XD I had seen it used on the pages but I never knew for what it was I’m so nuuby Probably I skipped that class. Thanks guys for the help!!