Layout with Flexbox: advanced CSS.

What is it?

Let’s look at flexbox components:

Untitled

Create a flex container

Let’s write the code to start playing with it.

<!DOCTYPE html>
<html>
	<head>
	<style>
		.container {
			background-color: blue;
			margin: 10px;
		}
	
		.container-item {
			background-color: yellow;
			color: blue;
			text-align: center;
			margin: 10px;
			width: 70px;
		}
		</style>
	</head>

	<body>
		<div class="container">
			<div class="container-item">A</div>
			<div class="container-item">B</div>
			<div class="container-item">C</div>
			<div class="container-item">D</div>
			<div class="container-item">E</div>
		</div>
	</body>

</html>

Now let’s give to our container the property display:flex;. See what changes.

Flex Direction & Wrap