How to handle small screens in css ? Is small font good practise ? (shadcn-ui + tailwind)

This question is coming back regularly to my head when i deal with responsive design for small screen especially. I am using shadcn-ui and tailwind for design. Default font size is 16px (iirc). For desktop everything seems to be fit well but when I am doing responsive design its not so awesome. For example, iphone 16 and card component, seems like padding and text is too big, could be small i guess. I approach most of the time this problems in either two ways - doing everything by hand and component level using media breakpoints - making everything using em unit then setting font-size on the component level recently I was thinking maybe I should set breakpoints for body font size level (rem unit). (and because everything seems to be working on rem units it should scale out of box right ? ) How such stuff is solved in real world apps? What are good practise ? Thanks
8 Replies
ishto
ishto3mo ago
As someone who doesn't do web, I think doing break points like:
@media (max-width: 768px) {
body {
font-size: 90%;
}
}
@media (max-width: 768px) {
body {
font-size: 90%;
}
}
or similar is a good way to handle stuff, just as you suggested
b1mind
b1mind3mo ago
Don't use REM/EM for padding would be my fix
clevermissfox
clevermissfox3mo ago
I'm a clamp lady
interpod
interpod3mo ago
On some of these pages there is this zoom-out effect on mobile phones. So everything is smaller but font size is the same, I am wodering how this effect could be achived ?
clevermissfox
clevermissfox3mo ago
What pages are you referencing? Link?
interpod
interpod3mo ago
https://rss.knf.gov.pl/rss_pub/ example from the top of my mind
Chris Bolson
Chris Bolson3mo ago
That site that you have used as an example doesn't have the meta viewport defined. That is why it looks terrible on smaller screens. The "viewport" meta tag is necessary to ensure that the site scales properly on different viewport sizes. Perhaps you are also missing this snippet in your codebase? It needs to look something like this: <meta name="viewport" content="width=device-width, initial-scale=1.0">
interpod
interpod3mo ago
With meta tag this webiste would be full of overflows i guess I have this meta tag on my web, so I have oveflow I was wondering if there is some easy/fast way to make effective mobile views and how often fonts are decreased to make everything looks better on mobile
Want results from more Discord servers?
Add your server