<header id="logo">
<img src="logo.png" />
<h1>Some text here</h1>
</header>
Run Code Online (Sandbox Code Playgroud)
我用
h1{display: inline;}
Run Code Online (Sandbox Code Playgroud)
使它们在同一行,但文本低于图像,图像是48x48px,文本大小是23px,我想使文本在视觉上居中于图像,我怎么能用CSS做到这一点?只需要支持Chrome.
谢谢你的回答,终于搞定了:http://jsfiddle.net/tFdpW/
thi*_*dot 16
像这样?http://jsfiddle.net/xs4x6/
<header id="logo">
<img src="http://dummyimage.com/48x48/f0f/fff" />
<h1>Some text here</h1>
</header>
header img {
vertical-align: top
}
h1 {
display: inline;
font-size: 23px;
line-height: 48px
}
Run Code Online (Sandbox Code Playgroud)