I have this code. I gave my body a display:flex
. Now, shouldn't all child elements become flex items, being inside the body and the body is 1. a flex container and 2. a wrapper for all the children?
So I tried looking through the developer's tools inside Firefox: align-items
/ justify-content
has no effect on this element since it’s neither a flex container nor a grid container.
Please explain to me when I need to give each div, section, main, a display:flex
on it is own and when it is automatically inherited.
Here is my code:
#html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Butterfly Music App</title>
</head>
<body>
<main>
</main>
<footer>
</footer>
</body>
</html>
#css
html, body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
background-color: cyan;
font-family: gabriola;
color: purple;
}
footer {
justify-content: flex-end;
align-items: flex-start;
flex: 0 0 120px;
background-color: pink;
}