With the code below I am attempting to practice a simple header with flex content below it. The content is generic lorem ipsum with a background image. Unfortunately, when I run the code, the items do not "flex." they just show up in a vertical line. Any idea what I am doing wrong?
also, bonus question - when I do a background image, how do I get it to automatically shrink to fit the size of its container?
Thanks!
Brian
Tried manipulating the flex qualities and also looked up similar questions.
header {
height: 80px;
width: 1235px;
display: flex;
background-color: gray;
color: black;
vertical-align: middle;
justify-content: center;
}
header h1{
background-color: gray;
color: black;
}
.flex{
height: 1000px;
width: 1235px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
}
.box{
width: 250px;
height: 250px;
background-image: url(./WS1.jpg);
background-repeat: no-repeat;
margin: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./GReat.css">
<title>Great</title>
</head>
<body>
<header>
<h1>This Page is Great!</h1>
</header>
<div class="Flex">
<div class ="box">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
<div class ="box">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
<div class ="box">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
<div class ="box">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
</div>
</body>
</html>