两个段落/Div 内联
您好,我不知道如何解决特定问题,所以这里是。 在不使用表格的情况下,我想显示一个包含多行文本的段落,然后在右侧显示一个图像。
到目前为止我已经尝试过:
<div id="container">
<p>
Some Text
Some Text
Some Text
Some Text
</p>
<p>
<img src="image.jpg"/>
</p>
</div>
我使用单独的样式表 并尝试过诸如内联显示之类的事情,但没有成功。
我将不胜感激任何建议,尽管我不想使用表格,因为我不喜欢使用表格进行布局。
谢谢。
Hi there I am not sure how to go about a particular problem so here it is.
Without using a Table I would like to display a paragraph with multiply lines of text then have an image on the right.
So far I have tried this:
<div id="container">
<p>
Some Text
Some Text
Some Text
Some Text
</p>
<p>
<img src="image.jpg"/>
</p>
</div>
I use a separate stylesheet
and have tried such things as display inline with no luck.
I will be grateful for any suggestions although I do not want to use a table as I am not a fan of using tables for layout.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要另一组独立于您的容器的容器:
You need another set of containers indie your container:
如果您可以考虑使用flexbox(现在得到了很好的支持:https://caniuse.com/#feat= flexbox )
你只需要让你的容器成为一个显示器:flex; (示例:https://codepen.io/anon/pen/GvZYwj)
了解更多信息关于 flexbox 你可以通过阅读 MDN 开始:https://developer.mozilla.org/en-US/docs/网页/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes。
如果你想了解更多关于 Flexbox 的信息,这里有一个很棒的教程: http://flexboxzombies.com/ p/flexbox-僵尸
If you may consider using flexbox (which is fairly well supported now : https://caniuse.com/#feat=flexbox )
You just need to make your container a display : flex; (example : https://codepen.io/anon/pen/GvZYwj)
For more infos about flexbox you can start out by reading MDN : https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes.
And if you want to get more about flexbox, there is this amazing tutorial : http://flexboxzombies.com/p/flexbox-zombies
如果我明白你想做什么。您可以为
标签指定一个类/样式,并在 CSS 中执行 float:right 操作。看起来像这样:
If I understand what you're wanting to do. You could give the
tag a class/style and do float:right in the CSS. Which would look like this:
您想要文字围绕图像流动吗?如果是,那么它是这样的:
http://jsfiddle.net/2FMPf/1/
如果您想要单独的图像列,那么它是这样的:
http://jsfiddle.net/2FMPf/2/
Do yo want text flow around image? If yes then it is something like this:
http://jsfiddle.net/2FMPf/1/
If you want separate column for image, then it is something like this:
http://jsfiddle.net/2FMPf/2/