Hello team,
I’m using a default Casper theme.
I want to make these changes to my font size on mobile:
- 20px font-size
- 1.6em line-height
How to do it?
I looked here Text sizing adjustments but still no idea how to do it.
Hello team,
I’m using a default Casper theme.
I want to make these changes to my font size on mobile:
How to do it?
I looked here Text sizing adjustments but still no idea how to do it.
You can add something like this to a <style>
in your Code Injection > Site Header
@media (max-width: 650px) {
.gh-content>p {
font-size: 20px;
line-height: 1.6em;
}
}
Note that this will change the font size for your post body text for any screen under 650px.
Cool, thanks! Added in code injection section.
Do I need to restart Ghost or clear cache to see changes - seems they are not yet on website. NGL: ANONYMOUS Q&A - HOW TO USE? FULL OVERVIEW
Thanks! By the way, I have disabled Member button “Unlock all content” in Ghost settings, why is it still showing up for you? Is it caching?
Hmm I’ve tried using the following but the font isn’t changing on mobile:
<style>
@media (max-width: 650px) {
.gh-content>p {
font-size: 30px;
line-height: 1.6em;
}
}
</style>
Maybe I’m missing something
It’ll depend on your theme. Can you share your site?
I’m lazy, I use clamp() for font size, no media query needed
font-size: clamp(0.9rem, 2vw, 1.3rem)
Generator: https://clamp.font-size.app
Guide: Linearly Scale font-size with CSS clamp() Based on the Viewport | CSS-Tricks - CSS-Tricks
clamp(minimum, preferred, maximum);
Also… "clamp()" | Can I use... Support tables for HTML5, CSS3, etc
Sure, HTML5/CSS3 workis fine in Ghost HTML Cards/Snippets.