我想知道爲什麼會出現巨大的白空間上面SEACH酒吧,而無需使用任何保證金或填充,使用inline-block的時候;額外空白
小提琴:https://jsfiddle.net/2jf0a7oc/
HTML:
<header>
<div class="logo">
<img
src="https://www.google.co.in/images/nav_logo.png">
</div> <!--END logo -->
<div class="search">
<form action="http://google.com/search">
<input type="text" name="q" placeholder="Search...">
<input type="submit" value="Go" title="Search">
</form>
</div> <!--END search -->
</header>
CSS:
header{ background:white; }
.logo{ display:inline-block; }
.logo img{ display:block; height:67px; width:102px; margin:14px 0; }
.search{ display:inline-block; }
.search input[type="text"]{ border:0; padding:10px; width:300px; float:left; background:grey; }
.search input[type="submit"]{ border:0; width:35px; padding:10px; }
[內嵌/內聯塊元素的CSS垂直取向]的可能的複製(HTTP:/ /stackoverflow.com/questions/9670469/css-vertical-alignment-of-inline-inline-block-elements) – Vucko