两个段落/Div 内联

发布于 2024-12-13 11:06:56 字数 378 浏览 4 评论 0原文

您好,我不知道如何解决特定问题,所以这里是。 在不使用表格的情况下,我想显示一个包含多行文本的段落,然后在右侧显示一个图像。

到目前为止我已经尝试过:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

猫卆 2024-12-20 11:06:56

您需要另一组独立于您的容器的容器:

<div style="float:left;width:50%">
<p>...<p/>
</div>
<div style="float:left;width:50%">
<p>...<p/>
</div>

You need another set of containers indie your container:

<div style="float:left;width:50%">
<p>...<p/>
</div>
<div style="float:left;width:50%">
<p>...<p/>
</div>
魂ガ小子 2024-12-20 11:06:56

如果您可以考虑使用flexbox(现在得到了很好的支持:https://caniuse.com/#feat= flexbox

你只需要让你的容器成为一个显示器:flex; (示例:https://codepen.io/anon/pen/GvZYwj

#container { 
  display: flex;
}

了解更多信息关于 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)

#container { 
  display: flex;
}

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

淡淡の花香 2024-12-20 11:06:56

如果我明白你想做什么。您可以为

标签指定一个类/样式,并在 CSS 中执行 float:right 操作。看起来像这样:

<p style="float:right;"><img src="image.jpg" /></p>

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:

<p style="float:right;"><img src="image.jpg" /></p>
酒浓于脸红 2024-12-20 11:06:56

您想要文字围绕图像流动吗?如果是,那么它是这样的:

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文