Hollow circle items - html

I would like to achieve circle cuts/hollows in the layer that covers the background images.
I have the background image covered with white tint (opacity 60%).
On the background, I have 3 circles that include text.
How can I cut "rings" in the white tint?
I would like to make hollows/cuts in the white tint like here:
My code looks now as below:
body {
margin: 0;
}
.block {
position: relative;
width: 100%;
}
.bg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -3;
}
.bg:before {
content: "";
background: #ffffff;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
}
.bg img {
display: block;
object-fit: cover;
object-position: center;
width: 100%;
height: 100%;
}
.wrapper {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
gap: 0 30px;
}
.item {
background: #aaaaaa;
width: 150px;
height: 150px;
border-radius: 100%;
display: flex;
flex-direction: columns;
justify-content: center;
align-items: center;
padding: 10px;
}
.item h2 {
font-family: Arial, sans-serif;
font-size: 15px;
color: #000000;
text-align: center;
margin: 0;
}
<section class="block">
<div class="bg">
<img src="https://i.picsum.photos/id/98/1920/1080.jpg?hmac=38vHAR4QCfR9YGpaasbQ0h390ZJnDlnQqzv3xTDF6ik" alt="" />
</div>
<div class="wrapper">
<div class="item">
<div class="item__content">
<h2>Heading 1</h2>
</div>
</div>
<div class="item">
<div class="item__content">
<h2>Heading 2</h2>
</div>
</div>
<div class="item">
<h2>Heading 3</h2>
</div>
</div>
</section>

You can do it like below. I have simplified the code as well:
body {
margin: 0;
}
section {
min-height: 100vh;
/* a grid container with 3 columns*/
display: grid;
grid-template-columns: 1fr 1fr 1fr;
/* the image as background */
background: url(https://i.picsum.photos/id/98/1920/1080.jpg?hmac=38vHAR4QCfR9YGpaasbQ0h390ZJnDlnQqzv3xTDF6ik) center/cover;
}
.item {
overflow: hidden; /* hide the overflow of the shadow */
/* center the heading */
display: grid;
place-items: center;
/**/
}
.item h2 {
width: 80%; /* adjust this to control the size */
aspect-ratio: 1; /* keep it a perfect circle */
box-sizing: border-box;
border-radius: 50%;
/* center the content of the heading */
display: grid;
place-items: center;
/**/
padding: 20px; /* this will control the inner space */
background: rgb(255 255 255/60%) content-box; /* color only the content area */
box-shadow: 0 0 0 100vmax rgb(255 255 255/60%); /* a big box-shadow */
}
<section>
<div class="item">
<h2>Heading 1</h2>
</div>
<div class="item">
<h2>Heading 2</h2>
</div>
<div class="item">
<h2>Heading 2</h2>
</div>
</section>

Related

div style messed up when zooming in

heres my project and i've been having a hard time trying to figure out the reason why this div "leftCardapio", whenever its zoomed in, the elements inside of it increase their height and width.
i have no ideia what this may be, can someone please gimme a hand?
appreciate the help.
here is my full projecttt
/* Variables */
:root {
--Gray: #323a3a;
--DarkBlue: #123B79;
--LightBlue: #18A5A7;
--LightGray: #D9D9D9;
--White: white;
}
html,
body {
margin: 0 auto;
user-select: none;
background-color: black;
font-family: 'Arial';
/* overflow: hidden; */
}
/* Order:
Bottom,
Left,
Top,
Content,
Container
*/
/* Container DIV*/
.container {
display: flex;
justify-content: center;
margin: 0 auto;
width: 100vw;
height: 100vh;
}
.content {
text-align: center;
background-color: gray;
position: absolute;
right: 0;
width: 100%;
height: 100%;
}
#img_Content {
height: 97%;
width: 100%;
object-fit: cover;
}
/* Bottom DIV */
.bottom {
display: flex;
flex-direction: column;
position: absolute;
background-color: black;
bottom: 0;
margin-left: 0%;
width: 100%;
height: 10%;
}
/* LEFT DIV */
.left {
display: flex;
flex-direction: column;
column-gap: 10px;
background-color: var(--Gray);
position: absolute;
left: 0;
width: 10%;
height: 100%;
}
.itemDestaque,
.itemCardapio,
.itemBebidas,
.itemReservar_mesa {
display: flex;
flex-direction: column;
padding-top: 10%;
display: inline-block;
vertical-align: middle;
text-align: center;
overflow: hidden;
cursor: pointer;
flex: 1;
}
.itemDestaque {
margin-top: 33%;
}
.itemDestaque,
.itemCardapio,
.itemBebidas,
.itemReservar_mesa span {
font-weight: 550;
overflow: hidden;
color: white;
}
.itemCardapio:hover,
.itemDestaque:hover,
.itemBebidas:hover,
.itemReservar_mesa:hover {
box-shadow: 5px 20px 20px rgba(0, 0, 0, 0.5);
background-color: var(--LightBlue);
}
#destaqueIMG,
#cardapioIMG,
#bebidasIMG,
#reservar_mesaIMG {
height: 80%;
width: 40%;
display: inline-block;
vertical-align: middle;
object-fit: contain;
overflow: hidden;
}
#bebidasIMG {
width: 30%;
}
/* LEFT CARDAPIO DIV */
.leftCardapio {
display: none;
}
.itemCardapio:hover>.leftCardapio {
display: flex;
flex-direction: column;
background-color: white;
text-align: center;
position: absolute;
left: 0;
top: 0;
margin-left: 100%;
width: 250px;
height: 100%;
}
.itemPratos,
.itemSaladas,
.itemSopas,
.itemSobremesas,
.itemMolhos,
.itemPorcoes {
height: 80px;
width: 100%;
background-color: lightgray;
border-bottom: 3px solid white;
}
.itemPratos:hover,
.itemSaladas:hover,
.itemSopas:hover,
.itemSobremesas:hover,
.itemMolhos:hover,
.itemPorcoes:hover {
background-color: var(--DarkBlue);
}
/* LEFT BEBIDAS DIV */
.leftBebidas {
display: none;
}
.itemBebidas:hover>.leftBebidas {
display: flex;
flex-direction: column;
background-color: white;
text-align: center;
position: absolute;
left: 0;
top: 0;
margin-left: 100%;
width: 250px;
height: 100%;
}
.itemBebida1 {
height: 80px;
width: 100%;
background-color: lightgray;
border-bottom: 3px solid white;
}
.itemBebida1:hover {
background-color: var(--DarkBlue);
}
/* TOP DIV */
/* Top Box 1 = Logo Recanto
Top Box 2 = Mesa
Top Box 3 = Pesquisa
Top Box 4 = Conta
Top Box 5 = Pedidos */
.top {
display: flex;
flex-direction: row;
background-color: #123B79;
position: absolute;
top: 0;
width: 100%;
height: 7%;
}
.topBox1 {
display: flex;
flex-direction: row;
flex: 8;
}
.topBox2,
.topBox3,
.topBox4,
.topBox5 {
text-align: center;
cursor: pointer;
flex: 1;
}
.topBox2 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
background-color: #ffffff;
}
.topBox3,
.topBox4,
.topBox5 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
border-right: 1px solid #2fa9ab;
background-color: var(--LightBlue);
}
.topBox2:hover {
transform: scale(1.0);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
background-color: #dadada;
}
.topBox3:hover,
.topBox4:hover,
.topBox5:hover {
transform: scale(1.0);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
background-color: #4eb9bb;
border-right: none;
}
.imgTopBox1 {
display: flex;
justify-content: center;
align-items: center;
width: 19%;
height: 100%;
}
#logoRecanto {
max-width: 100%;
max-height: 90%;
}
#mesaIMG,
#pesquisarIMG,
#contaIMG,
#pedidosIMG {
width: 20%;
max-height: 100%;
display: inline-block;
vertical-align: middle;
object-fit: contain;
overflow: hidden;
}
#mesaIMG {
filter: invert(0%) sepia(9%) saturate(0%) hue-rotate(130deg) brightness(0%) contrast(0%);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="./imgs/HMSC_Catavento.png">
<link rel="stylesheet" href="css/style.css">
<title>Restaurante Recanto </title>
</head>
<body>
<div class="container">
<div class="content">
<img src="./imgs/Prato_Content_5.png-" id="img_Content">
</div>
<div class="bottom"></div>
<div class="left">
<div class="itemDestaque">
<img src="./imgs/Destaque.png" id="destaqueIMG">
<br><span> DESTAQUE</span>
</div>
<div class="itemCardapio" id="itemCardapio">
<img src="./imgs/Cardapio2.png" id="cardapioIMG">
<br><span> CARDÁPIO </span>
<div class="leftCardapio">
<div class="itemPratos"></div>
<div class="itemSaladas"></div>
<div class="itemSopas"></div>
<div class="itemSobremesas"></div>
<div class="itemMolhos"></div>
<div class="itemPorcoes"></div>
</div>
</div>
<div class="itemBebidas">
<img src="./imgs/Bebidas.png" id="bebidasIMG">
<br><span> BEBIDAS </span>
<div class="leftBebidas">
<div class="itemBebida1"></div>
<div class="itemBebida1"></div>
<div class="itemBebida1"></div>
<div class="itemBebida1"></div>
<div class="itemBebida1"></div>
<div class="itemBebida1"></div>
</div>
</div>
<div class="itemReservar_mesa">
<img src="./imgs/Mesa.png" id="reservar_mesaIMG">
<br><span> RESERVAR MESA </span>
</div>
</div>
<div class="top">
<div class="topBox1">
<div class="imgTopBox1">
<img src="./imgs/LogoRecanto.png" id="logoRecanto">
</div>
</div>
<div class="topBox2">
<img src="./imgs/Mesa.png" id="mesaIMG">
</div>
<div class="topBox3">
<img src="./imgs/Pesquisar.png" id="pesquisarIMG">
</div>
<div class="topBox4">
<img src="./imgs/Conta.png" id="contaIMG">
</div>
<div class="topBox5">
<img src="./imgs/Pedidos.png" id="pedidosIMG">
</div>
</div>
</div>
<!-- <script src="./scripts/changeImg.js"></script> -->
</body>
</html>
Your sub-menu elements increase in height when you zoom because that's the expected behavior of the zoom. Try zooming on any site or even here on stack-overflow.
When you zoom in browser what happens is that your visible area dimensions decrease. For example lets say your page is 1000px wide, when you zoom in to 200% it's now 500px wide, but these 500px are stretched to 1000px on your monitor.
On your site everything except sub-menu has % width and height. So if element width is 10% on 1000px screen it's 100px. If you zoom to 200% it's 10% of 500px, so 50px. Visually it stays the same size. Now when you have fixed dimensions on element like you have on your sub-menu, 80px is still 80px no matter how much you zoom in. On 500px screen of course 80px element will take more space then on 1000px screen.
Note the 80px height

Align circles and text made with css

I made this layout but I can't find a way to align the circles and the text on the same line. As you can see in the first picture there's a problem both with circles and text. I'd like to achive the result you see in the 2nd picture.
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.grid {
display: flex;
flex-wrap: wrap;
max-width: 980px;
width: 100%;
margin: auto;
padding-top: 5%;
padding-bottom: 5%;
}
.cell {
flex-basis: 33.3%;
display: flex;
justify-content: center;
align-items: center;
}
.cell:before {
padding-bottom: 100%;
display: block;
content: '';
}
.circle {
width: 250px;
height: 250px;
border: 0.5px solid;
border-radius: 50%;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
box-shadow: 0px 0px 15px 0px;
overflow: hidden;
margin: 0 auto 1em;
}
.circle img {
width: 100%;
position: relative;
height: 100%;
}
h3 {
text-align: center;
}
.inner {
text-align: start;
padding-bottom: 15%;
}
<div class="grid">
<div class="cell">
<div class="inner">
<div class="circle" style="background-image:url('https://freight.cargo.site/t/original/i/655f74e74d3b88cc9d367ba8cccd79680c3837a84a547f9e03b6f39981f424e0/3.png');"></div>
<div class="caption">
<h3>Chiara Bersani <br> Marta Montanini</h3>
</div>
</div>
</div>
First, you will have to remove your manual line breaks <br>. Once you do this, the text can wrap automatically without having odd breaks at specific breaking points. If you want to force a line break, use horizontal padding on .caption h3.
Once you do this, just use align-items: self-start; on .grid.
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.grid {
display: flex;
flex-wrap: wrap;
align-items: self-start;
max-width: 980px;
width: 100%;
margin: auto;
padding-top: 5%;
padding-bottom: 5%;
}
.cell {
flex-basis: 33.3%;
display: flex;
justify-content: center;
align-items: center;
}
.cell:before {
padding-bottom: 100%;
display: block;
content: '';
}
.circle {
width: 250px;
height: 250px;
border: 0.5px solid;
border-radius: 50%;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
box-shadow: 0px 0px 15px 0px;
overflow: hidden;
margin: 0 auto 1em;
}
.circle img {
width: 100%;
position: relative;
height: 100%;
}
.caption h3 {
text-align: center;
padding: 0 2em;
}
.inner {
text-align: start;
padding-bottom: 15%;
}
<div class="grid">
<div class="cell">
<div class="inner">
<div class="circle" style="background-image:url('https://freight.cargo.site/t/original/i/655f74e74d3b88cc9d367ba8cccd79680c3837a84a547f9e03b6f39981f424e0/3.png');"></div>
<div class="caption">
<h3>Chiara Bersani Marta Montanini</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle" style="background-image:url('https://freight.cargo.site/t/original/i/655f74e74d3b88cc9d367ba8cccd79680c3837a84a547f9e03b6f39981f424e0/3.png');"></div>
<div class="caption">
<h3>Chiara Bersani Longer TEXT...........................</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle" style="background-image:url('https://freight.cargo.site/t/original/i/655f74e74d3b88cc9d367ba8cccd79680c3837a84a547f9e03b6f39981f424e0/3.png');"></div>
<div class="caption">
<h3>Chiara Bersani Marta Montanini more text lorem foo</h3>
</div>
</div>
</div>
</div>

Trying to get banner inside of the header

I am trying to get a banner with "slogan" and an image to appear inside the header area. When I write it out it appears below the header section, and I cannot figure out how to get it inside the header area.
I would also like to make it responsive. So I would like the "slogan" to move up and the image to move below the "slogan" when it reaches less than 768px
Thanks
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Cabin', sans-serif;
}
/* Header */
.header-image {
background-image: url('https://images.unsplash.com/photo-1472376758045-62f519fc676d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8300925c51f6d651fa7cb9c41eaafb45&auto=format&fit=crop&w=2850&q=80');
background-position: center;
background-size: cover;
background-attachment: scroll;
color: white;
width: 100%;
height: 49em;
}
.header-wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
height: 49em;
}
.logo {
grid-column: 1;
display: flex;
justify-content: flex-start;
margin-left: .5em;
}
.nav-header {
grid-column: 2;
list-style: none;
display: flex;
justify-content: space-around;
}
/* Banner */
.slogan,
.banner {
margin: 0;
}
.banner-image {
width: 15em;
height: 15em;
border-radius: 50%;
}
<!-- HEADER -->
<header class="header-image">
<div class="header-wrapper">
<h1 class="logo">STARTUP NAME</h1>
<nav>
<ul class="nav-header">
<li class="navmenu">Services</li>
<li class="navmenu">Pricing</li>
<li class="navmenu">Contact</li>
</ul>
</nav>
</div>
</header>
<!-- BANNER -->
<section class="main-banner">
<div class="banner-container">
<h1 class="slogan banner">Some Cool Slogan</h1>
<span class="slogan banner">A cool subtitle explaining said cool Slogan</span>
<img class="banner-image banner" src="https://images.unsplash.com/photo-1532007271951-c487760934ae?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=f7ad947fb913065733cd1494ed95ef59&auto=format&fit=crop&w=1100&q=80" alt="">
</div>
</section>
I adjusted the code to have a wrapper around the title and to have it at the center of the page. And added media query CSS to come one below the other in mobile
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Cabin', sans-serif;
}
/* Header */
.header-image {
background-image: url('https://images.unsplash.com/photo-1472376758045-62f519fc676d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8300925c51f6d651fa7cb9c41eaafb45&auto=format&fit=crop&w=2850&q=80');
background-position: center;
background-size: cover;
background-attachment: scroll;
color: white;
width: 100%;
height: 49em;
}
.header-wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
height: 49em;
}
.logo {
grid-column: 1;
display: flex;
justify-content: flex-start;
margin-left: .5em;
}
.nav-header {
grid-column: 2;
list-style: none;
display: flex;
justify-content: space-around;
}
/* Banner */
.slogan,
.banner {
margin: 0;
}
.banner-image {
width: 15em;
height: 15em;
border-radius: 50%;
}
section.main-banner {
position: absolute;
width:100%;
text-align:center;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.sloganWrapper{
display:inline-block;
vertical-align: middle;
}
img.banner-image.banner {
vertical-align: middle;
}
#media only screen and (max-width:767px){
.sloganWrapper{
display:block;
}
}
<!-- HEADER -->
<header class="header-image">
<div class="header-wrapper">
<h1 class="logo">STARTUP NAME</h1>
<nav>
<ul class="nav-header">
<li class="navmenu">Services</li>
<li class="navmenu">Pricing</li>
<li class="navmenu">Contact</li>
</ul>
</nav>
</div>
</header>
<!-- BANNER -->
<section class="main-banner">
<div class="banner-container">
<div class="sloganWrapper">
<h1 class="slogan banner">Some Cool Slogan</h1>
<span class="slogan banner">A cool subtitle explaining said cool Slogan</span></div>
<img class="banner-image banner" src="https://images.unsplash.com/photo-1532007271951-c487760934ae?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=f7ad947fb913065733cd1494ed95ef59&auto=format&fit=crop&w=1100&q=80" alt="">
</div>
</section>
I think it's because your .main-banner is not being contained in the header.
Try making header position: absolute; and then move the banner image to .main-banner
See if it's what you need...
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Cabin', sans-serif;
}
/* Header */
.header-wrapper {
position: absolute;
top: 0;
left: 0;
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
color: #fff;
}
.logo {
grid-column: 1;
display: flex;
justify-content: flex-start;
margin-left: .5em;
}
.nav-header {
grid-column: 2;
list-style: none;
display: flex;
justify-content: space-around;
}
/* Banner */
.main-banner {
padding-top: 100px;
background-image: url('https://images.unsplash.com/photo-1472376758045-62f519fc676d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8300925c51f6d651fa7cb9c41eaafb45&auto=format&fit=crop&w=2850&q=80');
background-position: center;
background-size: cover;
background-attachment: scroll;
color: white;
width: 100%;
height: 49em;
margin-bottom: 20px;
}
.slogan,
.banner {
margin: 0;
}
.banner-image {
width: 15em;
height: 15em;
border-radius: 50%;
}
<!-- HEADER -->
<header>
<div class="header-wrapper">
<h1 class="logo">STARTUP NAME</h1>
<nav>
<ul class="nav-header">
<li class="navmenu">Services</li>
<li class="navmenu">Pricing</li>
<li class="navmenu">Contact</li>
</ul>
</nav>
</div>
</header>
<!-- BANNER -->
<section class="main-banner">
<div class="banner-container">
<h1 class="slogan banner">Some Cool Slogan</h1>
<span class="slogan banner">A cool subtitle explaining said cool Slogan</span>
<img class="banner-image banner" src="https://images.unsplash.com/photo-1532007271951-c487760934ae?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=f7ad947fb913065733cd1494ed95ef59&auto=format&fit=crop&w=1100&q=80" alt="">
</div>
</section>
Testing

Wanting height of two objects to match in spite of expanding content

I have a page that has three main section:
project-arrow-box
white-green
light-gray
project-arrow-box and light-gray are on the left side of the page and white-green is on the right. I am wanting light-gray and white-green's bottom to meet at the same point and touch my footer. My white-green's section will change size based if validation errors are made or whatever the case may be. On different screen sizes these two divs (light-gray and white-green) very in placement. Sometimes light-gray surpasses white-green and vise versa. Again, I want the end/bottom of those two divs to touch my footer regardless of the screen size.
I have tried adding bottom: 0; to both of light-gray and white-green, but this did not help. I have white-green's height set to auto, so it adapts to the expanding nature of this div. This happened before the footer, so the footer has nothing to do with any of these issues.
What can I do so this becomes possible?
.project_arrow_box {
position: relative;
/*background: rgb(69,186,149);*/
background: #00a16d;
border: 4px solid #00a16d;
width: 33%;
height: 800px;
z-index: 99;
}
#project-content-wrap {
margin: 30% 13%;
}
.white-green {
background-color: rgb(241, 250, 247);
width: 66.56%;
height: auto;
z-index: 55;
margin-left: 33.4%;
margin-right: 0;
position: absolute;
top: 0;
right: 0;
text-align: center;
}
#white-green-section {
position: relative;
left: 30%;
text-align: center;
opacity: 0;
}
.light-gray {
background-color: #E0E0E0;
width: 33.5%;
padding-top: 150px;
bottom: 0;
margin-bottom: 0;
}
.light-gray-container {
left: 15%;
position: relative;
width: 80%;
height: auto;
padding-bottom: 40px;
}
<div class="project_arrow_box">
<div id="project-content-wrap">
</div>
</div>
<div class="white-green">
<div id="white-green-section">
</div>
</div>
<div class="light-gray">
<div class="light-gray-container">
</div>
</div>
You can do this with Flexbox
body, html {
margin: 0;
padding: 0;
}
.container {
display: flex;
}
.left {
display: flex;
flex-direction: column;
flex: 0 0 33%;
}
.one {
background: #A1EB88;
flex: 100vh;
}
.two {
flex: 100vh;
background: #F2BB7C;
}
.three {
background: lightblue;
flex: 1;
}
footer {
height: 50px;
background: red;
width: 100%;
}
<div class="container">
<div class="left">
<div class="one">One</div>
<div class="two">Two</div>
</div>
<div class="three">Three</div>
</div>
<footer>Footer</footer>
Using Flexbox is likely the simplest way to pull that off:
HTML:
<div class="container">
<div class="left-container">
<div class="project-arrow-box">
<p>
</p>
</div>
<div class="light-grey">
<p>
</p>
</div>
</div>
<div class="white-green">
<p>
</p>
</div>
</div>
<div class="footer">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, vero?
</p>
</div>
CSS:
.container, .left-container, .white-green {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6, BB7 */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
display: flex; /* NEW, Spec - Firefox, Chrome, Opera */
margin: 0;
}
.left-container {
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-direction: column;
}
.project-arrow-box {
background-color: white;
flex-grow: 1;
padding: 1em;
}
.light-grey {
background-color: #aaa;
flex-grow: 1;
padding: 1em;
}
.white-green {
background-color: #ccFFcc;
flex-grow: 1;
padding: 1em;
}
.footer {
background-color: #000;
color: #fff;
}
See: https://jsfiddle.net/bL2ymhps/1/

transform an old layout to flexbox

Currently I have this layout.
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
min-height: 100%;
}
#wrapper {
height: 100%;
min-height: 100%;
position: relative;
background-color: red;
}
header {
height: 100%;
min-height: 100vh;
position: relative;
background-color: green;
text-align: center;
}
#header-top {
position: fixed;
left: 0;
right: 0;
top: 0;
width: 100%;
outline: 1px dotted red;
background-color: blue;
}
#header-middle {
position: relative;
top: 50%;
transform: translateY(-50%);
background-color: yellow;
outline: 1px dotted red;
}
#header-bottom {
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
background-color: grey;
outline: 1px dotted red;
}
<div id="wrapper">
<header>
<div id="header-top">
<p>I am fixed at the top</p>
</div>
<div id="header-middle">
<p>I am vertically centered</p>
</div>
<div id="header-bottom">
<p>I am stuck at the bottom but not fixed</p>
</div>
</header>
</div>
How do I use flexbox here to get the same layout.
The html, body and #wrapper needs to expand visually to surround all the child elements.
The header is to fill the entire viewport.
The #header-top is fixed at the top containing a logo floated to left and navigation floated to right with no explicit height.
The #header-middle is to be vertically centered inside the header.
The #header-bottom is like a sticky footer stuck at the bottom but no fixed.
Fiddle
Use this:
header {
display: flex; /* Magic begins */
flex-direction: column; /* Stack vertically */
height: 100%; /* As tall as the containing block */
justify-content: space-between; /* Distribute the flex items */
}
* {
padding: 0;
margin: 0;
}
html, body, header {
height: 100%;
}
header {
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: green;
text-align: center;
}
header > div {
outline: 1px dotted red;
}
#header-top {
background-color: blue;
}
#header-middle {
background-color: yellow;
}
#header-bottom {
background-color: grey;
}
<header>
<div id="header-top">
<p>I am fixed at the top</p>
</div>
<div id="header-middle">
<p>I am vertically centered</p>
</div>
<div id="header-bottom">
<p>I am stuck at the bottom but not fixed</p>
</div>
</header>