Answers for "how to align image in html to center"

CSS
14

html center image

/* Here is the CSS code! */
img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
Posted by: Guest on October-17-2020
0

html center image

<div class="verticalhorizontal">
    <img src="image.jpg" alt="centered image" />
</div>

<style>
.verticalhorizontal {
    display: table-cell;
    height: 300px;
    text-align: center;
    width: 300px;
    vertical-align: middle;
}
</style>
Posted by: Guest on October-06-2021

Code answers related to "how to align image in html to center"

Browse Popular Code Answers by Language