Dean 0

Hey, I'm having trouble with a design that requires two divs, one contained within the other. I need the contained div to be 56 pixel higher than the container div.

The container div needs to expand according to the content, so a fixed layout is not an option.

<div id="container>
    <div id="contained">
        The content
    </div>
</div>

is it possible?

1 answer

0
points

The only way to achieve this would be to apply a float to the contained div, but not to the container div so your container div is what's called a collapsed parent (see this article for more info on floats and the collapsed parent).

I wouldn't recommend this though as it is counter-intuitive mark-up. Can you explain further what you're trying to achieve as I'm sure they will be a more logical solution.

Answered about 6 years ago by John Catterfeld