用CSS包围div的文本 [英] Wrapping text around a div with CSS

查看:131
本文介绍了用CSS包围div的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的XHTML中获取一个文本来包装 div 。我的XHTML看起来像这样....

I am trying to get a text to wrap around a div in my XHTML. My XHTML looks like so....

<div id="cont-content">


<p>content</p>

<p>more content</p>

<div id="content-sidebar">

 BLALALALALLAAL

 </div>

  </div>

我的CSS看起来像...

And my CSS looks like...

#content-sidebar {
    display: block;
    float: right;
    width: 270px;
    height: 400px;
    border: 1px solid red;
}

你能看到文本不会包围这个div的任何原因吗? / p>

Can you see any reason why the text will not wrap around this Div?

推荐答案

是你收到的。 #content-sidebar应该在所有的文本之前应该包装它。像这样:

Yep you got it. The #content-sidebar should be before all the texts which are supposed to wrap it. Like this:

<div id="cont-content">

<div id="content-sidebar">

 BLALALALALLAAL

 </div>

<p>content</p>

<p>more content</p>


  </div>

这篇关于用CSS包围div的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆