jongacnik / gr8

Customizable, functional css utilities
MIT License
174 stars 11 forks source link

Responsive using root font-size #16

Closed tttimur closed 7 years ago

tttimur commented 7 years ago

Maybe something like

var css = gr8({
  responsiveRoot: true,
  rootSizes: {
    xl: '250%',
    lg: '200%',
    md: '100%',
    sm: '62.5%'
  }
})

Which would return

@media (max-width: 1439px) {
  html{font-size: 250%}
}

@media (max-width: 1260px) {
  html{font-size: 200%}
}

@media (max-width: 1023px) {
  html{font-size: 100%}
}

@media (max-width: 767px) {
  html{font-size: 62.5%}
}
jongacnik commented 7 years ago

@siiiick thanks for the note! Working on some gr8 updates over the next week-ish, will keep this in mind. One thing I wonder is if the overhead of needing to drop those queries in manually is enough to warrant it part of the lib?

var css = gr8()

var responsiveRoot = `
  @media (max-width: 1439px) {
    html{font-size: 250%}
  }

  @media (max-width: 1260px) {
    html{font-size: 200%}
  }

  @media (max-width: 1023px) {
    html{font-size: 100%}
  }

  @media (max-width: 767px) {
    html{font-size: 62.5%}
  }
`

var mycss = responsiveRoot + css.toString()
tttimur commented 7 years ago

yea thats exactly what I'm doing right now, maybe I'll fork it and see if I can do something

jongacnik commented 7 years ago

feel free, but just as heads up v3 will have some api changes, details soon

tttimur commented 7 years ago

Good call, thanks!