HTML元素显示在水平线 [英] HTML element display in horizontal line

查看:89
本文介绍了HTML元素显示在水平线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在div中有两个HTML元素。我想将它们显示在一行或一个水平线。
假设我有两个图像,代码如下所示。我如何使它,所以在第一个元素后没有换行符,所以他们将一个接一个水平地显示。现在第二个图像显示在第一个图像下面。我想要第二个图像显示在第一个的右边。我很确定这可以在CSS中完成。请帮助。

I have two HTML elements inside a div. I want to display them in a row or a horizontal line. Let's say I have two images with the code shown below. How would I make it so there is no line break after the first element so they will be displayed one after the other horizontally. Right now the second image is displayed below the first. I want the second image to be displayed to the right of the first. I am pretty sure this can be done in CSS. Please Help.

<img src="image one.jpg">
<img src="image two.jpg">


推荐答案

选项1 p>

Option 1

img {
 display:inline;
}

选项2 b

img {
 display:block;
 float:left;
}

然而,这只有在图像有足够的水平空间题。

However, this will only work if there is enough horizontal space for the images in question.

这篇关于HTML元素显示在水平线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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