如何将div中的img对齐到右边? [英] how to align img inside the div to the right?
本文介绍了如何将div中的img对齐到右边?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在div的右侧对齐图像?
I would like to know how to align the image inside the div on the right side?
推荐答案
您可以给 div
a
text-align: right
这将在图像左侧保留空白。 (=图片将占据整行)。
this will leave white space to the left of the image. (= the image will occupy the whole line).
如果您希望内容显示在图片的左侧,请使用
If you want content to be shown to the left hand side of the image, use
float: right
图片。但是,周围的 div
然后将需要 overflow:auto
延伸到所需的高度。
on the image. However, the surrounding div
will then need overflow: auto
to stretch to the needed height.
这篇关于如何将div中的img对齐到右边?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文