Comments (6)
Thanks for the issue @baglio,
You need more than one breakpoint to make the respond mixin work. For example, one at 640px and another at 960px. The text will transition between these two points. If you wish to have it scale up from a viewport width of 0px, then 0px needs to be defined in your breakpoints as well.
from modularscale-sass.
Also, you may be interested in Typetura.js for even more control over how your typography responds to its context 💁♂️
from modularscale-sass.
I was trying to use REM, but the following does not work either:
$modularscale: (
base: 16px,
ratio: 1.25,
0px: (
base: 16px,
ratio: 1.25
),
1440px: (
base: 18px,
ratio: 1.333
)
);
The 1440px settings are simply ignored. No font sizes are being rendered for @media (min-width: 1440px)
from modularscale-sass.
@baglio Did that info help?
from modularscale-sass.
@baglio Did that info help?
Yes, by setting a 0px breakpoint it does work, although to get there it uses some complicated CSS calc stuff, which I'm not confident using. Since I just wanted to have a different base font size for each of my breakpoint, I solved by setting the base
keyword to 1rem instead of 16px, and then set a different font-size on the body for each breakpoint like so:
$modularscale: (
base: 1rem,
ratio: 1.333,
);
body {
font-weight: 300;
font-size: 12px;
font-family: $body;
line-height: 1.5;
-webkit-text-size-adjust: 100%; // Impedisce al font di cambiare se si cambia l'orientamento del dispositivo.
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@include breakpoint($medium){
font-size: 14px;
}
@include breakpoint($large){
font-size: 16px;
}
}
from modularscale-sass.
Thanks @baglio, glad it helped!
The complicated CSS calc stuff comes from this post by Mike Riethmuller: https://www.madebymike.com.au/writing/precise-control-responsive-typography/
You might have also heard the term CSS Locks, coined by Tim Brown and explained by Chris Coyier : https://css-tricks.com/css-locks/
Agreed, the calc function can be complicated. This is why I created typetura.js: https://github.com/typetura/typetura.js
from modularscale-sass.
Related Issues (20)
- Implement a way to disable viewport-based typography in version 3 ($ms-fluid: false) HOT 1
- Disable px rounding option HOT 3
- Output calculation as rem value HOT 2
- Both regular and non-conflict ms functions are returning raw output HOT 6
- Removal of ms-round-px causes build failure HOT 7
- SyntaxError on @import HOT 6
- Eyeglass v2.0.0 support HOT 3
- Deprecation warning HOT 1
- Not working for REM on media query HOT 5
- www.-less links to modularscale.com not redirecting
- No mixin named ms-respond HOT 2
- Eyeglass v3 support
- modularscale.com & www.modularscale.com are redirecting to separate websites HOT 3
- Deprecation warnings after upgrading Sass when using `ms` Variable HOT 21
- Changes to responsive logic HOT 2
- On CSS locks and `clamp()` HOT 6
- 4.x - Importing modular scale using ratio string results in an error
- A lite dart-sass implementation, and proposal for contribution HOT 3
- Syntax for responsive HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modularscale-sass.