textをどのデバイスでも大体同じバランスで表示したいので、
無段階にパーセンテージで指定したい。
画像に変換したり、SVGに変換したりせず、やる方法はありませんか?
html
1<div id="background"><div id="text">abcd</div></div>
css
1body{ 2 margin: 0; 3 padding: 0; 4} 5#background{ 6 position: absolute; 7 8 background-color: #aa3d3d; 9 10 width: 100%; 11 height: 100%; 12} 13#text{ 14 margin: auto; 15 16 position: absolute; 17 top: 0; 18 bottom: 0; 19 20 color: #fff; 21 22 text-align: center; 23 font-size: 100px; 24 25 width: 100%; 26 height: 30%; 27}
これはあくまでも画面に対して中央寄せをしただけなのでこのスタイルでなくとも、
中央寄せしてくれるとわかりやすいです。(僕が)
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。