Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 30, 2023 06:02 pm GMT

Responsive Text - Without @media queries

Once upon a time, I had a website where it looked great on laptop, but when I switched to phone, the text was SO TINY!!!.

So I started messing around with @media queries and found them a bit too hard to use.

Then I searched my problem in Google and found this StackOverflow post.
It had the answer to my problem!

The answer is pretty simple actually. You use the calc() function in CSS, and use rem and vmin units to write this code:

body {  font-size: calc(0.75em + 1vmin);}

I made responsive text with just 3 lines of CSS and without @media queries!


Original Link: https://dev.to/vulcanwm/responsive-text-without-media-queries-4enc

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To