header-logoというdivタグの括りの中に、256×50の画像のみを挿入しました。
表示上、画像に関しては256×50(border/padding/marginなし)のサイズで画面で表示されているのですが、
header-logoの大きさを検証で確認してみると、256×58となっていました。(こちらもborder/padding/marginなし)
何故header-logoのheightが8px多くなってしまうのでしょうか?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" href="css/styles.css"> </head> <body> <header> <div class="container"> <!-- header-logoの大きさが256*58となる。(padding/border/margin は0) --> <div class="header-logo"> <!-- 256*50の画像を挿入 画面上に同サイズで表示される --> <img src="img/logo.png" alt=""> </div> <div class="header-list"> <ul> <li>A</li> <li>B</li> <li>C</li> </ul> </div> </div> </header> </body> </html>
body{ font-family: "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック体", YuGothic, "游ゴシック", "Yu Gothic", "メイリオ", sans-serif; background: #ffffff; color: #555555; } .container{ width: 980px; margin: 0 auto; } .header-logo{ background-color: yellow; float: left; } header{ height: 70px; background-color: red; } .header-list{ float: right; } .header-list li{ display: inline-block; }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/20 18:37
2019/08/20 18:51
2019/08/21 00:25