close[x]


CSS

CSS-Home CSS-Environment CSS-Basic syntax CSS-Selector CSS-How To Add CSS CSS-Comment CSS-Color CSS-Background CSS-Font CSS-Text CSS-Boarder CSS-Margin CSS-Padding CSS-Height/Width CSS-Link CSS-Table CSS-Visibility CSS-Scrollable CSS-Float/Clear CSS-Line CSS-Align CSS-Dimension CSS-Event CSS-Pusedo class CSS-Position CSS-Transparency CSS-Dropdown CSS-Form CSS-List/Counter CSS-Website layout CSS-Text effect CSS-Image effect CSS-Button effect CSS-page number CSS-Box CSS-@media CSS-Multi device CSS-Multi device 1 CSS-Multi device 2



learncodehere.com




CSS - Align

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.

Result