how to align content in center 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: how to center an image element inside a block in css
img { display:block;
margin-left: auto;
margin-right:auto;
}
Example 3: how to make a division center css
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
Example 4: center text css
p {
text-align: center;
}