Giter VIP home page Giter VIP logo

Comments (6)

scottkellum avatar scottkellum commented on June 14, 2024

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.

scottkellum avatar scottkellum commented on June 14, 2024

Also, you may be interested in Typetura.js for even more control over how your typography responds to its context 💁‍♂️

from modularscale-sass.

djmtype avatar djmtype commented on June 14, 2024

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.

scottkellum avatar scottkellum commented on June 14, 2024

@baglio Did that info help?

from modularscale-sass.

baglio avatar baglio commented on June 14, 2024

@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.

scottkellum avatar scottkellum commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.