Page 222 - Computer Software Application TP - Volume 1
P. 222
COMPUTER SOFTWARE APPLICATION - CITS
TASK 6: Using alignment
1 Open the text editor
2 Write the following codes
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0”>
<title>Bootstrap v5 Alignment Example</title>
<link href=”https://cdn.jsdelivr.net/npm/bootstrap@5.3.0
alpha1/dist/css/bootstrap.min.css” rel=”stylesheet”>
</head>
<body>
<div class=”container mt-5”>
<h1>Alignment Example</h1>
<h2>Vertical Alignment</h2>
<div class=”d-flex align-items-start mb-3”>
<div class=”p-2 bg-info”>Start aligned</div>
</div>
<div class=”d-flex align-items-center mb-3”>
<div class=”p-2 bg-success”>Center aligned</div>
</div>
<div class=”d-flex align-items-end”>
<div class=”p-2 bg-warning”>End aligned</div>
</div>
<h2>Horizontal Alignment</h2>
<div class=”d-flex justify-content-start mb-3”>
<div class=”p-2 bg-danger”>Start aligned</div>
</div>
<div class=”d-flex justify-content-center mb-3”>
<div class=”p-2 bg-primary”>Center aligned</div>
</div>
<div class=”d-flex justify-content-end”>
<div class=”p-2 bg-secondary”>End aligned</div>
</div>
<h2>Self-Alignment (Individual Item Alignment)</h2>
<div class=”d-flex align-items-start”>
<div class=”p-2 bg-info align-self-start”>Start aligned</div>
<div class=”p-2 bg-success align-self-center”>Center aligned</div>
<div class=”p-2 bg-warning align-self-end”>End aligned</div>
</div>
</div>
<script src=”https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js”></script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Verify the output.
207
CITS : IT & ITES - Computer Software Application - Exercise 49