Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k 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.7k 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;

}

Related questions

Browse Categories

...