Book a Free Call

Responsive Font Sizes without media-query



I think I’m getting comfortable enough with where the browsers are to ignore the Explorers and the old Safaris a bit more. I’m just hearing it less – “needs to work on Explorer” is something I haven’t heard in a year, and when I did, that was for a modern enough version, so I’m gradually relying on Flex a bit more and so on. Just embracing it.

Well here’s a nice one. CSS font size with a min, constant and max parameter. So the below will never go below .175rem…it will try to be 4vw but cannot go over 3rem

font-size: clamp(1.75rem,4vw,3rem);

Robbed from this helpful post: https://stackoverflow.com/a/62808509/14842098

Need rapid website development:

For smaller projects at high speed


  • Adding script tag embed to Gatsby component

    Read More
  • Get more than 100 queries in GraphQL (I felt stupid)

    Read More
  • Animate on Scroll (AOS) into Nuxt js

    Read More
  • WordPress Super-admin hack

    Read More
  • Add content or ACF field under thumbnail/image gallery in Woocommerce

    Read More

Tags


Categories

Is it urgent? Donate to Cork Simon

Got an urgent issue?

Charlie's Cottage, Carrigrohane, Co. Cork, T12 WY9H

(085) 7686677