Anonymous 0

I narrowed down my issue to two browsers, Chrome and Safari, both webkit browsers. I have a form that is inserted via PHP, but whenever it is submitted, the font size changes to 16px which is the default of the user agent stylesheet! Why does the user agent stylesheet overwrite whenever I hit the submit button? I should also mention that it only happens when the if statement is true. However, you can see the code below, there is literally no reason for it to alter the appearance or ruling of a stylesheet.

        if (mysqli_num_rows($loginData) == 1) {
        echo 'You\'re in!';
        $userData = mysqli_fetch_array($loginData); 

    else {
        $error = mysqli_error($dbc);
        $loginError = 'Wrong username and/or passphrase.';

There is no font changing when I tried it in Firefox. What's up?

3 answers

Tarik 0
This was chosen as the best answer

I figured out the solution. I was echoing in PHP a phrase to confirm I have logged in before the stylesheet is loaded and for some reason, it overrides my stylesheet's font size with the user agent stylesheet.

Answered about 7 years ago by Tarik

Include this at the very tip-top of your stylesheet:

html { -webkit-text-size-adjust:none; }

This has solved some of my font-size conundrums in the past... not sure if it'll work in your case, but hey, it's worth a shot.

Answered about 7 years ago by Aric Evins
  • Did not work unfortunately, thanks though. Tarik about 7 years ago
Doug 1095

Difficult to answer without a link to the actual page. But the user agent stylesheet should NEVER overrule other styles you have set. Use "inspect element" to see what styles are being applied and in what order. I think it's likely you'll find that a class is getting changed/added somewhere or your specificity rules are messed up.

Answered about 7 years ago by Doug