Skip to content

Instantly share code, notes, and snippets.

@olamigokayphils
Created August 16, 2020 23:06
Show Gist options
  • Save olamigokayphils/77ecee33606de19f6bac4422e3c9d50c to your computer and use it in GitHub Desktop.
Save olamigokayphils/77ecee33606de19f6bac4422e3c9d50c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<style>
#intro {
font-weight: 700;
font-size: 25px;
text-align: center;
}
.box-container {
display: flex;
flex-direction: row;
gap: 25px;
justify-content: center;
flex-wrap: wrap;
}
.box {
width: 100px;
height: 100px;
flex-basis: 100px;
}
.box1 {
background-color: red;
}
.box2 {
background-color: green;
}
.box3 {
background-color: yellow;
}
.box4 {
background-color: gray;
}
</style>
<p id="intro">Centering Element in HTML with FlexBox</p>
<div class="box-container">
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment