[英]How do I make a div go to the rightside?
I have an image in a div, and I want it to go to the right side.我在 div 中有一个图像,我希望它转到右侧。 Right now it just keeps on sticking to the left side, overlapping another image in a div.
现在它只是继续粘在左侧,与 div 中的另一个图像重叠。 Any idea how to do this?
知道如何做到这一点吗?
You can use text-align: right
to align image to right side.您可以使用
text-align: right
将图像与右侧对齐。
.myDiv{ text-align: right }
<div class="myDiv"> <img src="https://images.pexels.com/photos/1254140/pexels-photo-1254140.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" width="200px" height="200px"> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.