how to align right in css code example

Example 1: css align center

//HTML
<div class="parent">
	<span>Hello World</span>
</div>

//CSS
.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}

Example 2: align div to the right

display:inline-block; float:right;

Example 3: css align to left

body {
  text-align: left;
}

Example 4: css right

.right {
  position: fixed; /* the fixed pos makes it work */
  right: /*how much you want to move it right 
    put % or px or rem at end of the amount */;
}

Example 5: align center css

margin: auto;

Tags:

Misc Example