CSS ALIGN

rainbow baker

 CSS ALIGN

  • The align in CSS is used for positioning the items along with setting the distribution of space between and around content items. 
  • We can align the items either horizontally or vertically.
  • The various methods and techniques are used to center them, by taking care of the left and the right margin, etc.

EXAMPLE

<!DOCTYPE html>
<html>
<head>
<style>
.center
{
margin: auto;
width;60%;
border;3px solid#73AD21;
padding: 10px;
}
</style>
</head>
<body>
<h1 style="color.green;">
WELCOME TO CSS
</h1>
<h2 style="color:red;">
Center Align Elements
</h2>
<div class="center">
This is div element on which margin auto is used to horizontally align it into center
</div>
</body>
</html>

OUTPUT


         WELCOME TO CSS
        Center Align Elements
        
     This is div element on which margin auto is used to horizontally align it into center.



Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send