CSSでフォントのサイズを変更するとき、フォントのサイズ(12pxから200px)に関係なく、テキストの「キャップの高さ」(pic)が常に「視覚的に」10pxになるようにするにはどうすればよいですか上のパディング?
そうしないと、フォントサイズを変更するたびに、戻ってトップ/マージントップなどを再配置する必要があります.
ここに私が持っているものがあります:
CSS:
#header .statement {
position: relative;
background: white;
padding-top: 10px;
display: inline;
float: left;
margin-left: 0;
margin-right: 0;
width: 960px;
}
#header .statement h3 {
position: relative;
font-size: 160px;
letter-spacing: -10px;
font-weight: bold;
color: #141414;
font-family: Helvetica, sans-serif;
text-align: center;
}
HTML サンプル:
<div id='header'>
<div class='intro'>
Stuff before the statement
</div>
<div class='statement'>
<h3>
<p>A Statement</p>
</h3>
<div class='large_spacer'></div>
</div>
<div class='clearfix'></div>
</div>
これは、次のようになりline-height: 0
ます。
代替テキスト http://ilove4d.com/ex/css-typography.png
これは次のline-height: 1
とおりです:
代替テキスト http://ilove4d.com/ex/css-typography-2.png
を 160px から 20pxに変更するとfont-size
、空白が比例して小さくなります...どうすればそれを回避できますか?
注: margin:0;padding:0;... の場合でも、20 ピクセルの余分な空白が追加されます。