Css – Wrapping text around a div with CSS

cssxhtml

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>

And my CSS looks like…

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

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

Best Solution

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>