0 votes
1 view
in Web Technology by (22.4k points)

I have the page structure as:

<div class="parent">

    <div class="child-left floatLeft">

    </div>

    

<div class="child-right floatLeft">

    </div>

</div>

Now, the child-left DIV will have more content, so the parent DIV's height increases as per the child DIV.

But the problem is child-right height is not increasing. How can I make its height as equal to its parent?

1 Answer

0 votes
by (40.3k points)

For the parent element, you can add the following properties:

.parent {

    overflow: hidden;

    position: relative;

    width: 100%;

}

Then, for .child-right use the code given below:

.child-right {

    background:green;

    height: 100%;

    width: 50%;

    position: absolute;

    right: 0;

    top: 0;

}

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...