Flexbox is a layout model for arranging items (horizontally or vertically) within a container, in a flexible and responsive way
display - Must be set to flex or inline-flex
flex-direction - Sets the display-direction of flex items
flex-wrap - Specifies whether the flex items should wrap or not
flex-flow - Shorthand property for flex-direction and flex-wrap
justify-content - Aligns the flex items when they do not use all available space on the main-axis (horizontally)
align-items - Aligns the flex items when they do not use all available space on the cross-axis (vertically)
align-content - Aligns the flex lines when there is extra space in the cross axis and flex items wrap
row (default)
column
row-reverse
Example
.flex-container {
display: flex;
flex-direction: row;
}The Grid Layout Module allows developers to easily create complex web layouts.
<html>
<head>
<style>
.container {
display: grid;
grid-template-columns: auto auto auto;
background-color: blue;
padding: 10px;
}
.container div {
background-color: #f1f1f1;
border: 1px solid black;
padding: 10px;
font-size: 30px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</body>
</html>1
2
0