sassやSCSSで、次のようにスタイルの作りおきをしたら、
ページ読み込み速度に影響が出ますか?
※要するにfor文で大量のスタイルが吐き出されるので、
その大量のスタイルをもった静的なcssファイルは、ページ読み込み時に重くならないか懸念しています。
css
1@for $i from 0 through 20 { 2 .u-p-r-#{$i * 25}mem { 3 padding-right:#{$i * .25em} !important; 4 } 5 .u-p-l-#{$i * 25}mem { 6 padding-left:#{$i * .25em} !important; 7 } 8 .u-p-t-#{$i * 25}mem { 9 padding-top:#{$i * .25em} !important; 10 } 11 .u-p-b-#{$i * 25}mem { 12 padding-bottom:#{$i * .25em} !important; 13 } 14} 15@for $i from 0 through 20 { 16 .u-p-r-#{$i * 5} { 17 padding-right:#{$i * 5px} !important; 18 } 19 .u-p-l-#{$i * 5} { 20 padding-left:#{$i * 5px} !important; 21 } 22 .u-p-t-#{$i * 5} { 23 padding-top:#{$i * 5px} !important; 24 } 25 .u-p-b-#{$i * 5} { 26 padding-bottom:#{$i * 5px} !important; 27 } 28}
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。