如何使图像漂浮到右边,同时保持顺序 [英] How to make images float to the right while staying in order
本文介绍了如何使图像漂浮到右边,同时保持顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有三个图片,我想浮动到一个div的右边。
I have three images that I'd like to float to the right side of a div.
<div>
<img src="one_cat.jpg"></img>
<img src="two_cats.jpg"></img>
<img src="three_cats.jpg></img>
</div>
我已为他们添加了 float:right
属性...
I've added a float: right
property to them...
img {
float: right;
}
<
... and while this puts them on the proper side, it also reverses their order.
这是我的代码。
如何将它们悬浮在div的右边,同时保持它们的顺序
How I can float them to the right of their div, while also keeping them in the order in which I've declared them?
推荐答案
浮动div容器/包装而不是图片
Float the div container/wrapper instead of the images
div {
float: right;
display: inline-block; /* might want to add this too , but not necessary */
}
这篇关于如何使图像漂浮到右边,同时保持顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文