center content html code example

Example 1: html center body

body {
  display:flex; flex-direction:column; justify-content:center;
  min-height:100vh;
}

Example 2: html center body

body {
max-width: max-content;
margin: auto;
}

Example 3: css center

// example 1 
div { display: grid; place-items: center; }

// example 3
div{ display:flex; align-items:center; }

// example 3
div { width: 100%; margin: 0 auto; }

Example 4: css text align center

body {
  text-align: center;
}

Example 5: align center html

<!-- use the center tag -->
<center>
  <!-- your code -->
</center>

Tags:

Html Example