postcss-responsive-type icon indicating copy to clipboard operation
postcss-responsive-type copied to clipboard

em units are not working

Open perrin4869 opened this issue 8 years ago • 5 comments

I reproduced the problem here: https://github.com/perrin4869/responsive_type_test

I am getting the warning this combination of units is not supported [postcss-responsive-type] while attempting to process the following:

div {
    font-size: responsive 1.2em 1.4em;
}

perrin4869 avatar Jun 07 '16 14:06 perrin4869

OK, I figured out why this is impossible to do... might need some documentation for other people to avoid confusion maybe?

perrin4869 avatar Jun 10 '16 15:06 perrin4869

Yep the exact combination of units that can be used needs to be documented somewhere. You can use em units for sizing, you just have to use them for the range as well

div {
  font-size: responsive 1.2em 1.4em;
  font-range: 26em 80em;
}

madeleineostoja avatar Jun 11 '16 00:06 madeleineostoja

Wait, actually, there's something I am failing to understand. Why can't:

.foo {
  font-size: responsive 3rem 6rem;
  font-range: 420px 1280px;
}

be converted simply to:

.foo {
  font-size: calc(3rem + 3 * ((100vw - 420px) / 860));
}

@media screen and (min-width: 1280px) {
  .foo {
    font-size: 6rem;
  }
}

@media screen and (max-width: 420px) {
  .foo {
    font-size: 3rem;
  }
}

perrin4869 avatar Jun 11 '16 06:06 perrin4869

there was definitely a reason for this, but it's been quite a while since I've worked on this repo and can't remember what it was for the life of me. I'll do a bit of digging...

madeleineostoja avatar Jun 11 '16 07:06 madeleineostoja

I found a work around here: https://github.com/seaneking/postcss-responsive-type/issues/30#issuecomment-391818260

ackushiw avatar May 24 '18 18:05 ackushiw