如何将图像与标题元素并排对齐? [英] How to align an image side by side with a heading element?

查看:113
本文介绍了如何将图像与标题元素并排对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码:

<div><img src="images/ConfigIcon.png"/><h1>System Configuration</h1></div>

我想使图像显示在我的h1标头旁边。但是我得到的是图像始终位于标题的顶部。有想法吗?

I want to make the image appear beside my h1 header. But what I get is that the image is always at top of my header. Any ideas?

推荐答案

< h1> 块级元素,浏览器通常会显示块级元素在元素之前和之后使用换行符。但是,您可以将其设置为内联内联块

<h1> is a block-level element, and browsers typically display the block-level element with a newline both before and after the element. However you can make it as inline or inline-block

h1 {
    display: inline;
}

<div><img src="images/ConfigIcon.png"/><h1>System Configuration</h1></div>

这篇关于如何将图像与标题元素并排对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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