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: css align items vertical center
.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}
Example 3: css center
.parent {
  display: flex;
  justify-content: center; 
  align-items: center; 
}
Example 4: center css
div.container4 {
    height: 10em;
    position: relative }
div.container4 p {
    margin: 0;
    background: yellow;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%) }
Example 5: center text in div container
text-align: center
Example 6: align center css
margin: auto;
 		
 
Comments
Post a Comment