The flex classes are used to control the layout of flexbox components.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Flex</h2>
<div class="d-flex bg-success p-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
</div>
</body>
</html>
Output:

Inline Flexbox Container: The .d-inline-flex class is used to create an inline flexbox container.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Inline Flexbox</h2>
<div class="d-inline-flex bg-success p-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
</div>
</body>
</html>
Output:

Horizontal Direction: The .flex-row class is used to display the flex items horizontally. By default the flexbox are placed horizontally. The .flex-row-reverse class is used to reverse the align of flexbox (right-align flexbox).
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Horizontal Flexbox</h2>
<h3>flex-row class</h3>
<div class="d-flex flex-row bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div> <br>
<h3>flex-row-reverse class</h3>
<div class="d-flex flex-row-reverse
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
</div>
</body>
</html>
Output:

Vertical Direction: The .flex-column class is used to display the flexbox vertically (stack to each other). The .flex-column-reverse class is used to put the flexbox vertically in reverse direction.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Vertical Flexbox</h2>
<h3>flex-column class</h3>
<div class="d-flex flex-column text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div> <br>
<h3>flex-column-reverse class</h3>
<div class="d-flex flex-column-reverse text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
</div>
</body>
</html>
Output:

Justify Content: The .justify-content-* classes are used to change the alignment of flexbox. The alignment of flexbox can be start, end, center, between and around.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">
Justify Content Flexbox
</h2>
<h5>justify-content-start class</h5>
<div class="d-flex justify-content-start
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
<h5>justify-content-center class</h5>
<div class="d-flex justify-content-center
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
<h5>justify-content-end class</h5>
<div class="d-flex justify-content-end
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
<h5>justify-content-between class</h5>
<div class="d-flex justify-content-between
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
<h5>justify-content-around class</h5>
<div class="d-flex justify-content-around
bg-success mb-3 text-white">
<div class="p-2 bg-primary">Flexbox 1</div>
<div class="p-2 bg-secondary ">Flexbox 2</div>
<div class="p-2 bg-info">Flexbox 3</div>
</div>
</div>
</body>
</html>
Output:

Fill/Equal Widths: The .flex-fill class is used to force the flex items into equal widths.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">
Fill/Equal Width Flexbox
</h2>
<div class="d-flex mb-3">
<div class="p-2 bg-primary flex-fill">
Flexbox 1
</div>
<div class="p-2 bg-secondary flex-fill">
Flexbox 2
</div>
<div class="p-2 bg-info flex-fill">
Flexbox 3
</div>
</div>
</div>
</body>
</html>
Output:

Grow: The .flex-grow-1 class is used on flexbox to take the rest of space.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">
Grow Flexbox
</h2>
<div class="d-flex mb-3">
<div class="p-2 bg-primary">
Flexbox 1
</div>
<div class="p-2 flex-grow-1 bg-secondary">
Flexbox 2
</div>
<div class="p-2 bg-success">
Flexbox 3
</div>
</div>
</div>
</body>
</html>
Output:

Order: The .order class is used to change the order of flexbox. The valid order classes
are from 0 to 12.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">
Order Flexbox
</h2>
<div class="d-flex mb-3">
<div class="p-2 bg-primary order-3">
Flexbox 1
</div>
<div class="p-2 bg-secondary order-1">
Flexbox 2
</div>
<div class="p-2 bg-success order-2">
Flexbox 3
</div>
</div>
</div>
</body>
</html>
Output:

Auto Margins: The .mr-auto and .ml-auto classes are used to add margins to the item. The .mr-auto class pushes the item to the right and .ml-auto class pushes the item to the left.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Auto Margins</h2>
<div class="d-flex bg-success mb-3 text-white">
<div class="p-2 bg-primary">
Flexbox 1
</div>
<div class="p-2 mr-auto bg-secondary ">
Flexbox 2
</div>
<div class="p-2 mr-auto bg-info">
Flexbox 3
</div>
</div>
<div class="d-flex bg-success mb-3 text-white">
<div class="p-2 bg-primary">
Flexbox 1
</div>
<div class="p-2 ml-auto bg-secondary ">
Flexbox 2
</div>
<div class="p-2 bg-info">
Flexbox 3
</div>
</div>
</div>
</body>
</html>
Output:

Wrap: The .flex-nowrap (default), .flex-wrap or .flex-wrap-reverse classes are used to control the wrap of flex items.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Flex Wrap</h2>
<h4>flex-nowrap class</h4>
<div class="d-flex flex-nowrap bg-success">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br><br>
<h4>flex-wrap class</h4>
<div class="d-flex flex-wrap bg-success">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br><br>
<h4>flex-wrap-reverse class</h4>
<div class="d-flex flex-wrap-reverse bg-success">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
</div>
</body>
</html>
Output:

Align Content: The .align-content-* classes are used to set the vertical alignment of flex items. The list of all classes are: .align-content-start (default), .align-content-end, .align-content-center, .align-content-between, .align-content-around and .align-content-stretch.
Note: The align content works for more than one rows of flex items.
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Align Content</h2>
<h4>align-content-start class</h4>
<div class="d-flex flex-wrap
align-content-start border"
style="height:250px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br>
<h4>align-content-around class</h4>
<div class="d-flex flex-wrap
align-content-around border"
style="height:250px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br>
<h4>align-content-stretch class</h4>
<div class="d-flex flex-wrap
align-content-stretch border"
style="height:250px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
</div>
</body>
</html>
Output:

Align Items: The .align-items-* classes are used to control the vertical alignment of flex items. The list of all classes are: .align-items-start, .align-items-end, .align-items-center, .align-items-baseline, and .align-items-stretch (default).
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Align Items</h2>
<h4>align-items-end class</h4>
<div class="d-flex align-items-end border"
style="height:150px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br>
<h4>align-items-baseline class</h4>
<div class="d-flex align-items-baseline border"
style="height:150px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
<br>
<h4>align-items-stretch class</h4>
<div class="d-flex align-items-stretch border"
style="height:150px">
<div class="p-2 border">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 4
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 5
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 6
</div>
<div class="p-2 border">
Welcome to GeeksforGeeks 7
</div>
</div>
</div>
</body>
</html>
Output:

Align Self: The .align-self-* classes are used to control the vertical alignment of flex items. The list of all classes are: .align-self-start, .align-self-end, .align-self-center, .align-self-baseline, and .align-self-stretch (default).
Example:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container mt-3">
<h1 style="color:green; text-align:center;">
GeeksforGeeks
</h1>
<h2 style="text-align:center;">Align Self</h2>
<h4>align-items-end class</h4>
<div class="d-flex" style="height:250px">
<div class="p-2 border align-self-start">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border align-self-center">
Welcome to GeeksforGeeks 2
</div>
<div class="p-2 border align-self-end">
Welcome to GeeksforGeeks 3
</div>
<div class="p-2 border align-self-baseline">
Welcome to GeeksforGeeks 1
</div>
<div class="p-2 border align-self-stretch">
Welcome to GeeksforGeeks 2
</div>
</div>
</div>
</body>
</html>
Output:

Supported Browser:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Similar Reads
Bootstrap 4 Tutorial Bootstrap 4 is an open-source framework for creating responsive web applications. It is the most popular CSS framework for creating mobile-first websites. It is free to use we can directly integrate Bootstrap 4 into our project using CDN Links or with npm. Bootstrap 4 Tutorial is designed to help be
3 min read
Bootstrap 4 Introduction Bootstrap is a free and open-source tool collection for creating responsive websites and web applications. It is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. It solves many problems which we had once, one of which is the cross-browser compati
3 min read
Layout
Content
Bootstrap 4 | TypographyTypography is a feature of Bootstrap for styling and formatting the text content. It is used to create customized headings, inline subheadings, lists, paragraphs, aligning, adding more design-oriented font styles, and much more. Bootstrap support global settings for the font stack, Headings and Link
3 min read
Bootstrap 4 ImagesBootstrap 4 provides classes to style images responsively, including responsive images that automatically adjust the size based on screen width, image shapes such as rounded or circular, and image thumbnails with optional borders and captions, facilitating flexible and attractive image layouts. The
4 min read
Bootstrap 4 | TablesBootstrap provides a series of classes that can be used to apply various styling to the tables such as changing the heading appearance, making the rows stripped, adding or removing borders, making rows hoverable, etc. Bootstrap also provides classes for making tables responsive. Simple Table: The .t
9 min read
Bootstrap | figure class with ExamplesA figure is used when one needs to display a piece of content, generally images with an optional caption. The figure class in Bootstrap is used to add styling to the default figure elements. The base .figure class is used to indicate a figure element. The .figure-img is used to indicate the image us
1 min read
Components
Bootstrap 4 | AlertsWe often see certain alerts on some websites before or after completing an action. These alert messages are highlighted texts that are important to take into consideration while performing a process. Bootstrap allows showing these alert messages on the website using predefined classes. The .alert cl
3 min read
Bootstrap 4 | BadgesThe .badge class is used to add additional information to the content. For example, some websites associate a number of notifications to the link. The notification number is seen when logged in to a particular website which tells the numbers of news or notifications to see by clicking it.Example: HT
3 min read
Bootstrap 4 | ButtonsBootstrap provides different classes that can be used with different tags, such as <button>, <a>, <input>, and <label> to apply custom button styles. Bootstrap also provides classes that can be used for changing the state and size of buttons. Also, it provides classes for app
5 min read
Bootstrap 4 | Button GroupsBootstrap offers classes which allow to group buttons along the same line, horizontally or vertically. The buttons to be grouped are nested inside a <div> element with the class .btn-group. Horizontally arranged button groups: The .btn-group class is used to create horizontally arranged button
4 min read
Bootstrap 4 | CardsA Bootstrap card is a flexible box containing some padding around the content. It includes the options for headers and footers, color, content, and powerful display options. It replaces the use of panels, wells, and thumbnails. It can be used in a single container called card. Basic Card: The .card
7 min read
Bootstrap 4 CarouselThe Bootstrap Carousel is used to create an image slide show for the webpage to make it look more attractive. It can be included in the webpage using bootstrap.js or bootstrap.min.js. Carousels are not supported properly in Internet Explorer, this is because they use CSS3 transitions and animations
2 min read
Bootstrap 4 | CollapseBootstrap 4 offers different classes for creating collapsible elements. A collapsible element is used to hide or show a large amount of content. When clicking a button it targets a collapsible element, the class transition takes place as follows:Â Â .collapse: It hides the content..collapsing: It appl
5 min read
Bootstrap 4 | DropdownsDropdowns are one of the most important parts of an interactive website. A dropdown menu is the collection of menu items that allow users to choose a value from the list. The .dropdown class is used to design the drop-down menu. Example: HTML <!DOCTYPE html> <html lang="en">
8 min read
Bootstrap 4 | FormsForm Layout: Bootstrap provides two types of form layout which are listed below: Stacked formInline form Stacked form: The stacked form creates input field and submit button in stacked format. Example: HTML <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Fo
5 min read
Bootstrap 4 | Input GroupsInput Groups in Bootstrap are used to extend the default form controls by adding text or buttons on either side of textual inputs, custom file selectors or custom inputs. Basic input groups: The following classes are the base classes that are used to add the groups to either side of the input boxes.
7 min read
Bootstrap 4 | JumbotronBootstrap 4 Jumbotron is a large, prominent container for displaying key content, such as headers or call-to-action messages, with customizable background colors and padding for emphasis. Steps to add jumbotron: Use a jumbotron class inside a div element.Write any text inside the div tag.Close the d
2 min read
Bootstrap 4 | List GroupsList Groups are used to display a series of content in an organized way. Use .list-group and .list-group-item classes to create a list of items. The .list-group class is used with <ul> element and .list-group-item is used with <li> element. Example: HTML <!DOCTYPE html> <html la
4 min read
Bootstrap 4 | ModalIn simple words, the Modal component is a dialog box/popup window that is displayed on top of the current page, once the trigger button is clicked. However, clicking on the modal's backdrop automatically closes the modal. Also, it must be kept in mind that Bootstrap doesn't support nested modals as
5 min read
Bootstrap 4 | NavsNav Menu: The .nav, .nav-item and .nav-link classes are used to create navigation menu. The .nav, .nav-item and .nav-link classes are used with <ul>, <li> and link element respectively. Example: HTML <!DOCTYPE html> <html lang="en"> <head> <title>Nav men
7 min read
Bootstrap 4 Navigation BarA navigation bar is used in every website to make it more user-friendly so that the navigation through the website becomes easy and the user can directly search for the topic of their interest. The navigation bar is placed at the top of the page.Basic Navigation Bar: The .navbar class is used to cre
8 min read
Bootstrap 4 | PaginationPagination is used to enable navigation between pages in a website. The pagination used in Bootstrap has a large block of connected links that are hard to miss and are easily scalable. Basic Pagination: The basic pagination can be specified using the following classes. The .pagination class is used
5 min read
Bootstrap 4 | PopoverThe popover is an attribute of bootstrap that can be used to make any website look more dynamic. Popovers are generally used to display additional information about any element and are displayed on click of mouse pointer over that element.The data-toggle = "popover" attribute is used to create popov
3 min read
Bootstrap 4 | Progress BarsA progress bar is used to display the progress of a process on a computer. A progress bar displays how much of the process is completed and how much is left. You can add a progress bar on a web page using predefined bootstrap classes. Bootstrap provides many types of progress bars.Syntax:Â Â <div c
4 min read
Bootstrap 4 | ScrollspySometimes while designing the website, we include some attractive features which makes website eye-catching. One of the features is Bootstrap scrollspy which target the navigation bar contents automatically on scrolling the area.Create scrollspy: The data-spy="scroll" and data-target=".navbar" attri
4 min read
Bootstrap 4 | TooltipA Tooltip is used to provide interactive textual hints to the user about the element when the mouse pointer moves over. For Example, in the below image GeeksForGeeks is a button and when the user mouse moves over it, the additional information "A computer Science Portal" pops-up will display. Toolti
2 min read
Bootstrap 4 | SpinnersBootstrap provides various classes for creating different styles of "spinner" to display the loading state of projects. These classes are inbuilt with HTML and CSS so no need to write any JavaScript to create them. We can also modify the appearance, size, and placement of the spinners with the class
7 min read
Bootstrap 4 | ToastToast is used to create something like an alert box which is shown for a short time like a couple of seconds when something happens. Like when the user clicks on a button or submits a form and many other actions. .toast: It helps to create a toast.toast-header : It helps to create the toast header.t
3 min read
Utilities
Extend