CSS align is used to align elements on web pages.
CSS align make items to align horizontally and vertically.
We can CSS align to align web page contents like texts, images, table etc.
We can set values of align properties with auto, left, right, center to margin, text-align, margin, float.
Example : CSS - Align
<!DOCTYPE html>
<html>
<head>
<style>
h6
{
text-align:center;
}
.one {
text-align: right;
border: 2px solid blue;
}
.two {
margin: auto;
width: 60%;
border: 2px solid blue;
padding: 10px;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
}
.three {
float: right;
width: 300px;
border: 2px solid blue;
padding: 10px;
}
</style>
</head>
<body>
<h6>CSS Align</h6>
<div class="one">
<p>CSS align is used to align elements on web pages.</p>
</div>
<hr>
<div class="two">
<p>CSS align is used to align elements on web pages.</p>
</div>
<hr>
<img src="css.jpg" alt="css" style="width:40%">
<hr>
<div class="three">
<p>CSS align is used to align elements on web pages.CSS align
make items to align horizontally and vertically.</p>
</div>
</body>
</html>
When the above code is compiled , it produces the following result.