标志图像和H1标题在同一行 [英] Logo image and H1 heading on the same line

查看:407
本文介绍了标志图像和H1标题在同一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建我的第一个网页,但遇到问题。

I wanna create my first web page but encountered a problem.

我有以下代码:

<img src="img/logo.png" alt="logo" />
<h1>My website name</h1>

我想知道如何使徽标和H1在同一行。
谢谢!

I want to know how to make the logo and the H1 to be in the same line. Thanks!

推荐答案

作为示例( 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;
}

DEMO

这篇关于标志图像和H1标题在同一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆