Keeping children elements within parent div limits with a dynamic-height child

Introduction

I have children containers inside a parent div
The parent div is fixed-height (750px)
Currently, the children are fixed-height too
One of these children, the second div of a div inside a table (yeah…), can/often go beyond its height, adding a vertical scrollbar, which is fine; this child has a defined height of 600px. We’ll call it main child
The sum of these heights are below the parent height, which can create an undesired white space, when the 600px-child content is less than or equal to these 600px

Template

I have built a simplified template to ease visualization and manipulation
The parent div is outlined with red
The inner, framework-generated (1) table is outlined with purple
The undesired space can be seen between the table bottom and the parent bottom

<!DOCTYPE html>
<html>
    <style>
        div {
            display: block;
            unicode-bidi: isolate;
        }
        tr {
            outline: 1px solid purple; /* Addition for demo */
        }

        .container {
            height: 750px; /* Fixed */
            left: 304px; /* CollapsiblePanel 300 + vLine 4 ... */
            outline: 1px solid red; /* Addition for demo */
            position: absolute;
        }
        .title {
            color: #BC1212;
            font-family: "Lucida Sans Unicode", sans-serif;
            font-size: 14px;
            font-weight: bold;
            padding-left: 10px;
        }
        .tabs {
            background-color: darkseagreen; /* Addition for demo */
            height: 33px;
            position: relative;
            white-space: no-wrap;
            width: 100%;
        }
        .content {
            background-color: lightblue; /* Addition for demo */
            height: 600px; /* To be turned into a min height */
            overflow: auto;
            position: relative;
        }
        .hLine {
            border-bottom: 1px solid #888;
            height: 1px;
            overflow: hidden;
            position: relative;
            width: 100%;
        }
        .CollapsibleContainer {
            height: 750px; /* Fixed */
            position: relative;
        }
        .CollapsiblePanel {
            background-color: AliceBlue;
            line-height: 750px; /* Addition for demo */
            position: absolute;
            text-align: center; /* Addition for demo */
            vertical-align: middle; /* Addition for demo */
            width: 300px;
        }
        .vLine {
            border-left: 1px solid #888;
            height: 100%;
            left: 300px;
            overflow: hidden;
            position: absolute;
            width: 4px; /* Fixed */
        }
    </style>

    <div>
    <table class="tabs"><tr><td>Tabs</td></tr></table>
    <span>

    <div class="CollapsibleContainer">
    <div class="CollapsiblePanel">Collapsible Panel</div>
    <div class="vLine"></div>

    <div class="container">
    <table width="100%">
    <tr><td><label class="title">Title</label></td></tr>
    <tr><td>
    <div>
        <div class="tabs">Tabs</div>
        <div class="content">
            Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
            Text<br />
        </div>
        <div class="hLine"></div>
    </div>
    </td></tr>
    <tr><td><input type="button" value="Action" style="display: block; margin-left: auto; margin-right: 0;"/></td></tr>
    </table>
    </div>

    </div>

    </span>
</html>

Goals

  • Change the fixed-height of 600px to be a min-height for the main child, and have it fill the white space
  • Keep all the containers inside the fixed-size parent div, so when the sum of the children heights goes beyond the 750px of the parent, they’re all inside it, with the main child having a vertical scrollbar accordingly
  • Remark 1: Since this above means to make the 600px-height main child div to fill the white space, this will result in the other children containers to stay at the bottom of the parent div at all times, which is great
  • Remark 2: Depending on the size of the screen, the bottom can be out-of-sight, but reachable by a general vertical scrollbar added by the web browser; the bottom child div is not supposed to be visible at all times (I think that’s a floating behaviour, and this is not what is expected). This is perhaps something due to the used framework (1) (or Windows?), but the website does not look the same on 1920×1080 external screen device and on 1920×1080 laptop screen device; just to be perfectly clear (I hope)

Issue

I can’t get the elements below the main one to stay inside the parent div: the main one pushes the others out-of-parent-bounds

Constraints

(1) The application is built upon an internal, old, unmaintained, legacy framework, on which I have from little to no control over: the generated HTML can’t be modified…
Only the CSS seems to be manipulable

The 750px height of the parent div has to stay, which means the parent height is known at all times

Extra-information

I have omitted/removed a lot of intermediary div/span containers, so the excerpt is clear and (I hope) easy to manipulate
I believe I’ve kept the minimal/necessary HTML/CSS bits to reproduce/show the issue, mainly the imbrication of the various containers (div, table)
I’ll handle the extra complex container hierarchy on my end when solution(s) will be shared ^^

Setting a height of 100% on the table moves and splits the extra-blank space above and below the main child div, couldn’t get anything better past this

I think at 1 point I had the main child div to have its bottom at the parent bottom… but lost that attempt

I have tried several things from SO and other websites without much success: there’s a lot of simple examples of keeping children containers inside parent div, but I’m unable to translate these to my case (probably just bad at it)

The section with a button can have more components (e. g. 2 lines of buttons); so the container is not fixed-height (but probably has a min-height somewhere, and if not, I’ll give it one)


I hope this is clear as to what the issue is and what is expected, and that the given information is well-ordered and useful ^^”

If you need anything other piece of information, let me know

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật