I was making a code formatter for my website and I encountered some strange behavior between desktop and mobile browsers. On desktop the code block looks like this:
and on my iphone the line numbers are, for whatever reason, in a smaller font size:
I haven't done anything to edit any sort of font sizes anywhere on my website. It's all default sizes. If I manually set the font size, say to 12px, it is still lined up on my desktop browser, and still smaller on my mobile browser.
The code block is laid out as a table with two cells. The left cell contains a 1 column table, each row contains a number. The right cell contains a 1 column table, each row contains a line of code.
Any idea why the font is shrunk on the mobile browser?
EDIT: LINK: http://grantslatton.com/posts/blog/2013-08-16/sudoku_solver/
EDIT2: It renders correctly on windows phones and android phones.
SOLUTION: Turns out mobile Safari decides to change text size for you! I saw a solution on this page that worked :Fix font size issue on Mobile Safari (iPhone) where text is rendered inconsistently and some fonts are larger than others?
I put -webkit-text-size-adjust: 100% in the body { } section of my CSS to prevent mobile safari from messing with my text size.
Adjusting Text SizeBy holding down "Ctrl" and tapping "-" you can reduce the size of the text inside a Web browser window (pressing "Ctrl" and "+" enlarges text). This keyboard shortcut works for most browsers, including Microsoft Internet Explorer, Mozilla Firefox, Google Chrome and Apple Safari.
Luckily, it's quite easy to change it back to normal. Here's how: If the text size is too small, press and hold the Ctrl key and then press the + key (that's the “plus” key) over on the numeric keypad until the size is back to normal.
The default text size in browsers is 16px.
Turns out mobile Safari decides to change text size for you! I saw a solution on this page that worked:
I put the following in my CSS to prevent mobile safari from messing with my text size.
body {
-webkit-text-size-adjust: 100%;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With