Div adaptive height automatically fills the remaining height

Div adaptive height automatically fills the remaining height

Scenario 1:

Html:

<div class="outer">
    <div class="A">Header DIV </div>
    <div class="B">Lower DIV</div>
</div>

CSS:

html,
body { height: 100%; padding: 0; margin: 0; }
.outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; position: relative; }
.A { height: 100px; background: #BBE8F2; position: absolute; top: 0 ; left: 0 ; width: 100%; }
.B { height: 100%; background: #D9C666; }

Effect:

Scenario 2:

HTML:

<div class="outer">
    <div class="A">Header DIV</div>
    <div class="B">Lower DIV</div>
</div>

CSS:

html,
body { height: 100%; padding: 0; margin: 0; }
.outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; }
.A { height: 100px; margin: -100px 0 0; background: #BBE8F2; }
.B { height: 100%; background: #D9C666; }

Effect:

This is the end of this article about div adaptive height to automatically fill the remaining height. For more relevant div adaptive height content, please search 123WORDPRESS.COM's previous articles or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  Not all pop-ups are rogue. Tips on designing website pop-ups

>>:  Deploy the Vue project on a Linux server

Recommend

Usage of MySQL time difference functions TIMESTAMPDIFF and DATEDIFF

Usage of time difference functions TIMESTAMPDIFF ...

Solution for Tomcat to place configuration files externally

question When we are developing normally, if we w...

Introduction to the usage of common XHTML tags

There are many tags in XHTML, but only a few are ...

Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary

Table of contents 1. Environmental Preparation 1....

JS, CSS and HTML to implement the registration page

A registration page template implemented with HTM...

Introduction to the steps of deploying redis in docker container

Table of contents 1 redis configuration file 2 Do...

Simple Implementation of HTML to Create Personal Resume

Resume Code: XML/HTML CodeCopy content to clipboa...

CSS to achieve text on the background image

Effect: <div class="imgs"> <!-...

Detailed explanation of the error problem of case when statement

Preface In the MySQL database, sometimes we use j...

Example of how nginx implements dynamic and static separation

Table of contents Deploy nginx on server1 Deploy ...

Should I use UTF-8 or GB2312 encoding when building a website?

Often when we open foreign websites, garbled char...

The whole process of realizing website internationalization using Vite2 and Vue3

Table of contents Preface Install vue-i18n Config...

Detailed explanation of how to restore database data through MySQL binary log

Website administrators often accidentally delete ...

Using JS to implement a rotating Christmas tree in HTML

<!DOCTYPE HEML PUBLIC> <html> <hea...