• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Mobile device simulation in Chrome/Edge developer tools

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Mobile device simulation in Chrome/Edge developer tools

    Wondering if this approach is a good idea for mobiles:

    html {
    font-size: calc(15px + 0.390625vw);
    }

    h1 {font-size:1.2rem; font-weight:bold; padding:0px; width:100%; text-align:center;}
    h2 {font-size:1.1rem; font-weight:bold; padding:0px; width:100%; text-align:center;}
    etc.

    https://matthewjamestaylor.com/responsive-font-size

    All looks pretty good on Chrome and Edge mobile simulators at various sizes but text rather small on my Pixel 4a. It is a reasonably recent one, got it 2 or 3 years ago and first release was in 2019 and Chrome is up to date. Must be quite a few older phones in use.
    Last edited by xoggoth; 4 May 2023, 12:32.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    #2
    Do something like:

    Code:
    @media screen and(max-width: 360px) {
        html {
            font-size: 18px;
        }
    }
    Where 360 is your desired size where you want to override the calculated size with something more legible.

    Comment


      #3
      This is a code smell...
      font-size: calc(15px + 0.390625vw);
      Why do you need to add a viewport width there? (this is probably the issue for your bug)
      you don't even need to use max-width

      you can use mobile-first approach and use min-width

      Comment


        #4
        Ah, some answers, cheers chaps! I'll do a bit more fiddling. Looks useful.
        Last edited by xoggoth; 23 May 2023, 20:18.
        bloggoth

        If everything isn't black and white, I say, 'Why the hell not?'
        John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

        Comment

        Working...
        X