markdown 响应式排版

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 响应式排版相关的知识,希望对你有一定的参考价值。



´´´css
body {
  // Never get smaller than this
  font-size: 14px;
}

@media (min-width:600px) {
  body {
    font-size: 16px;
  }
}

@media (min-width:800px) {
  body {
    font-size: 18px;
  }
}

@media (min-width:1000px) {
  body {
    // Never get larger than this
    font-size: 20px;
  }
}
´´´


*One way to get fluid typography is to change the font-size from pixels (px) to viewport units (vw)*

´´´css
body {
  font-size: 2vw;
}
´´´

*Now we're caught in a situation where the font-size can get infinitely smaller and larger.*
*If we use viewport units and calc(), the size can be fluid and within a defined range.*




´´´css
body {
  font-size: calc([minimum size] + ([maximum size] - [minimum size]) * ((100vw - [minimum viewport width]) / ([maximum viewport width] - [minimum viewport width])));
}
´´´

Example:
- minimum 14px at smallest viewport (300px)
- maximum 26px at the larget viewport (1600px)
*For the vertical rythm, we can apply the same equation to the line-height property*

´´´css
body {
  font-size: calc(14px + (26 - 14) * ((100vw - 300px) / (1600 - 300)));
  line-height: calc(1.3em + (1.5 - 1.2) * ((100vw - 300px)/(1600 - 300)));
}
´´´


以上是关于markdown 响应式排版的主要内容,如果未能解决你的问题,请参考以下文章

列表的响应式排版

html 响应式排版

css 响应式流体排版字体大小

css 响应式排版.css

scss Bootstrap响应式排版

Angular Material 中的响应式排版