V
V
Vladislav2017-12-16 19:02:49
css
Vladislav, 2017-12-16 19:02:49

Font-size formula?

body {
  font-size: 1.4rem;
}

@media only screen and (max-width: 1300px) {
  body {
    font-size: 1.3333333333333333rem;
  }
}

@media only screen and (max-width: 1200px) {
  body {
    font-size: 1.2727272727272725rem;
  }
}

@media (max-width: 1024px) and (min-width: 768px) {
  body {
    font-size: 1.4rem;
  }
}

By what formula did they find the font-size for 1200px and 1300px here?
Here is another example from the same css file.
p {
  font-size: 1.6rem;
}

@media only screen and (max-width: 1300px) {
  p {
    font-size: 1.5238095238095237rem;
  }
}

@media only screen and (max-width: 1200px) {
  p {
    font-size: 1.4545454545454546rem;
  }
}

With html font-size: 62.5% which is exactly 1rem = 10px

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-12-16
@webinar

sass, less and other technologies that generate css, they may have calculations such as division, as a result, not integers.
By the way, if you still write css manually - I highly recommend it. And gulp with them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question