Search code examples
htmlcssalignment

make one div wrap around another div


I've got a div containing two divs. One is an image with - values for top and left to make it sit on the top edge like a legend. But the div next to it just keeps it in one column to the left. Really, I want the text to wrap around, as to fill all the purple space. Here's what I've got:

//jsfiddle.net/ucfnL0px/1/embed/

Solution

  • You should put you image inside your div.CornPara and set it to float: left; and the text will wrap around it.

    See this Fiddle

    HTML

    <div class="ServContent">   
       <div class="CornPara">
           <img class="corner" src="#" />
           <h1 class="SubServ">Lorem</h1>
           ...More content...
        </div>
    </div>
    

    CSS

    img.corner {
      ...
      float: left;
    }