我想创建我的第一个网页,但遇到了问题。
我有以下代码:
<img src="img/logo.png" alt="logo" />
<h1>My website name</h1>
我想知道如何使 Logo 和 H1 在同一行。 谢谢!
最佳答案
例如(DEMO):
HTML:
<div class="header">
<img src="img/logo.png" alt="logo" />
<h1>My website name</h1>
</div>
CSS:
.header img {
float: left;
width: 100px;
height: 100px;
background: #555;
}
.header h1 {
position: relative;
top: 18px;
left: 10px;
}
关于html - 标志图片和H1标题在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11701311/