css image align code example
Example 1: css center image
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
Example 2: css align center
//HTML
<div class="parent">
<span>Hello World</span>
</div>
//CSS
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Example 3: image align center
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
Example 4: html css center image
<div style="text-align: center;">
<img scr='img/example.jpg'>
</div>
Example 5: how to make text center above image html
#container {
text-align: center;
}
.text {
display: inline-block;
margin: 0 20px 0 20px;
}
.img {
margin: 0 20px 0 20px;
width: 50px;
height: 50px;
}
Example 6: how to align an image left in css
<div style="text-align: left"><img src="image/your-image.png" width="100" /></div>Copy