What's new

Welcome to the forum 👋, Visitor

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

[HTML/CSS] - Flex Layout Div Stretch to bottom?

halMarkson

New member
Joined
May 17, 2023
Messages
1
Reaction score
0
HTML Coins
0
Hey fellow developers,

I'm currently working on a web project and I'm facing an issue with an HTML/CSS layout using flex divs. I'm hoping some of you can shed some light on the problem I'm experiencing.
The main problem is that my layout is not stretching to fill the entire page.

Code:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
display: flex;
flex-direction: column;
}
body > * {
flex-shrink: 0;
}
.div1 {
background-color: #5c88ed;
}
.div2 {
background-color: #90de90;
flex-grow: 1;
}
.div3 {
border: 1px solid black;
margin: 10px 10px 10px 10px;
padding: 10px 10px 10px 10px;
background-color: #FFFFFF;
flex-grow: 1;
}
.footer {
color: #FFFFFF;
padding: 10px 0px 0px 0px;
position: absolute;
bottom: 0;
height: 37px;
width: 100%;
background-color: #003366;
}
</style>

</head>
<body>
<div class=div1>
div 1
<br>
</div>
<div class=div2>
<div class=div3>
div 3
</div>
<br>
</div>
<div class=footer>
footer
</div>
</body>
</html>

Thanks in advance!
 

Attachments

  • Screenshot 2023-05-17 121434.png
    Screenshot 2023-05-17 121434.png
    5.6 KB · Views: 2

Theme customization system

You can customize some areas of the forum theme from this menu.

  • Wide/Narrow view

    You can control a structure that you can use to use your theme wide or narrow.

    Grid view forum list

    You can control the layout of the forum list in a grid or ordinary listing style structure.

    Picture grid mode

    You can control the structure where you can open/close images in the grid forum list.

    Close sidebar

    You can get rid of the crowded view in the forum by closing the sidebar.

    Fixed sidebar

    You can make it more useful and easier to access by pinning the sidebar.

    Close radius

    You can use the radius at the corners of the blocks according to your taste by closing/opening it.

  • Choose the color combination that reflects your taste
    Background images
    Color gradient backgrounds
Back