Correction TP la grille Bootstrap Ex03
Correction TP la grille Bootstrap Ex03
-
Objectifs
- Créer rapidement une mise en page flexible et responsive avec le système de grille.
-
Exercice 03
-
Énoncé
-
Solution
-
Vous pouvez visualiser l’énoncé de l’exercice
-
schémas01
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Exemple de grille</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<style>
/* Some custom styles to beautify this example */
.demo-content{
padding: 15px;
font-size: 18px;
background: rgba(255, 0, 0, 0.1);
margin-bottom: 10px;
margin-left: 10px;
border: 1px solid red;
border-radius: 4px;
text-align: center;
}
.demo-content.bg-alt{
background: rgba(255, 0, 0, 0.1);
}
</style>
</head>
<body>
<h2 class="text-center my-3">Disposition réactive Bootstrap</h2>
<div class="container mt-3">
<!--Row with two equal columns-->
<div class="row">
<div class="col-md-3">
<div class="demo-content">.col-md-3</div>
</div>
<div class="col-md-3">
<div class="demo-content bg-alt">.col-md-3</div>
</div>
<div class="col-md-3">
<div class="demo-content">.col-md-3</div>
</div>
<div class="col-md-3">
<div class="demo-content bg-alt">.col-md-3</div>
</div>
</div>
<!--Row with two columns divided in 1:2 ratio-->
<div class="row">
<div class="col-md-4">
<div class="demo-content">.col-md-4</div>
</div>
<div class="col-md-8">
<div class="demo-content bg-alt">.col-md-8</div>
</div>
</div>
<!--Row with two columns divided in 1:3 ratio-->
<div class="row">
<div class="col-md-3">
<div class="demo-content">.col-md-3</div>
</div>
<div class="col-md-7">
<div class="demo-content bg-alt">.col-md-7</div>
</div>
<div class="col-md-2">
<div class="demo-content bg-alt">.col-md-2</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>
</body>
</html>
schémas02
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<title>Bonjour tout le monde!</title>
<style>
body{padding-top: 10px;}
.rowCouleur{
height: 120px;
background-color: rgba(255,0,0,0.1);
border: 2px solid rgba(245, 8, 8, 0.5);
}
.colCouleur{
height: 40px;
background-color: rgba(255,0,0,0.1);
border: 2px solid blue;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="container">
<div class="row align-items-start rowCouleur" >
<div class="col colCouleur align-self-start">
align-self-start
</div>
<div class="col colCouleur align-self-center">
align-self-center
</div>
<div class="col colCouleur align-self-end">
align-self-end
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>
</body>
</html>