0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

font-sizeをremとvwを混ぜていい感じにレスポンシブに拡縮してくれるようにする

Last updated at Posted at 2017-08-28

僕は普段rem指定でフォントサイズを決めてるのですが、RWDの案件などでは横幅がiPadサイズとかになると、文字がとても小さくなり読みにくくなることがある。以下のコードでrem指定のまま、いい感じに拡縮できるようになる。

$sp_widthはPhotoshopなどのデザインデータの横幅。

html {
    font-size: 62.5%; 
}
@media (max-width: 899px) {
    html {
       $sp_width: 320px;
       font-size: 100vw * (10px / #{$sp_width}); 
}
0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?