Rui Chen Rui Chen - 5 months ago 15
CSS Question

How to make child elements flow outside of parent?

Currently I have an html file with DOM structure like this:

<div id="parent">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>

And I want to have a layout like this: the "child" divs float outside the parent, lining up like table cells in the same row, each child has bigger width and smaller height than the parent, and they child divs will cover up the bottom of the parent div.(I cannot post picture yet, so I can only describe it), this has to be done without changing the DOM structure.

I tried to make the child elements inline blocks and float left, but they just seem to keep piling up, is there a way to achieve it without changing the DOM?


You could use absolute positioning instead:

  height:300px; width:300px; position:relative;
  height:100px; width:300px; position:absolute;

Of course, this is only part of the CSS you need.