[英]How can I create an image with text on the side (left or right) with proper spacing in between
How can I copy the layout of this page? 如何复制此页面的布局?
I want to have an image with text on the right side of it but has to have a small space between them so they don't look too crowded and an image with text on the left. 我想在图像的右侧有一个图像,但是它们之间必须有一个很小的空间,这样它们才不会显得太拥挤,而在图像的左侧则是文本。 See sample page attached.
请参见所附的示例页面。
[Image] -space- [Text ]
[Text ] -space- [Image]
[Image] -space- [Text ]
This a link only answer, because the link describes it perfectly: 这是一个仅答案的链接,因为该链接完美地描述了它:
https://www.w3schools.com/Css/css_float.asp https://www.w3schools.com/Css/css_float.asp
The examples use CSS 'Flow'
to flow the image left
or right
. 这些示例使用CSS'Flow
'Flow'
left
right
图像。
You can then use CSS margin
or padding
to create a distance between text and image. 然后,您可以使用CSS
margin
或padding
来创建文本和图像之间的距离。
Hi please use the power of flex for the equal size and spacing between the content.flex is very handy and easy to use. 嗨,请使用flex的力量使内容之间的大小和间距相等。flex非常方便且易于使用。 I hope it will work for you.
希望它对您有用。
You can use the .my-space-between class for margin . 您可以将.my-space-between类用于margin。
.myflex{display:flex; justify-content:space-between; } .my-inner-item div{flex:1; } .my-space-between{flex:.1; }
<div class="myflex"> <div class="my-inner-item">my image will be here </div> <div class="my-space-between"></div> <div class="my-inner-item">my text will be here</div> </div> <div class="myflex"> <div class="my-inner-item">my image will be here </div> <div class="my-space-between"></div> <div class="my-inner-item">my text will be here</div> </div> <div class="myflex"> <div class="my-inner-item">my image will be here </div> <div class="my-space-between"></div> <div class="my-inner-item">my text will be here</div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.