+ 12
How can i make any of my image to come exactly at the center?
I want my image to be in the center.
5 Respostas
+ 11
in css:
img {
margin: 0 auto;
}
+ 9
@kamalijeet tq
+ 2
<!DOCTYPE html>
<html>
<head>
<title>Image in the center</title>
<style type="text/css">
.middle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
</style>
</head>
<body>
<div class="middle">
<img src="image.png">
</div>
</body>
</html>
+ 1
Depends on type of image you want!! place of <img> can be changed with attribute "style" and svg with its x and y coordinates. with <img>, use position values in % rather than px to make it more responsive on different screen sizes.
0
it does not work