Font-Scaling with screen dimension
-
Hi Forum,
I couldn't find a post of someone with the same problem, so I'm opening one up here:
I've tried to define all sizes (dimensions and font size) in percentages. This works well for most aspect ratios, but becomes problemativ for extrawide formats (eg. 21:9).
I tried to set a 'max content width' in Lay settings, which applies to the grid, but fonts keep scaling further when widening the window.
I tried to fix it myself by using custom CSS with a 'max font size' parameter as shown here, but had the feeling it was being ignored by my browser. (Edge)
Can you give me a hint on what class to apply the max font size to, or how to realize my idea?
Greetings,
Philipp -
arminunruh Global Moderatorwrote on Mar 14, 2023, 7:32 PM last edited by arminunruh Mar 14, 2023, 3:32 PM
hey there!
yes, a percentage based font size is actually a "vw" size which means viewportwidth, so the content max width setting will have no effect on this
you can add your own media queries
when you take a look at your textformat, you see: "HTML Class:" _Headline1
(it will be a different word)
then create css:
lay options → custom css & html → Custom CSS
(dont put this in custom css for desktop or mobile)@media (min-width: 1600px){ ._Headline1{ font-size: 70px!important; } }
https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries
Need custom programming for your Lay Theme site?
I regularly add new features to Lay Theme for free, based on user feedback. But if you or your client need something more specific, I’m happy to offer custom paid programming tailored to your project.
Email info@laytheme.com with the subject "Custom paid programming for Lay Theme" and a short description of what you need — I’ll reply with a cost estimate.
Custom features I build often make it into future Lay Theme updates, so your idea might benefit the whole community.
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it