+ 12

How can i make any of my image to come exactly at the center?

I want my image to be in the center.

10th Apr 2017, 9:35 AM
Siddharth
Siddharth - avatar
5 ответов
+ 11
in css: img { margin: 0 auto; }
10th Apr 2017, 10:01 AM
Kamil
Kamil - avatar
+ 9
@kamalijeet tq
12th Apr 2017, 1:32 PM
Siddharth
Siddharth - avatar
+ 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>
13th Apr 2017, 3:36 PM
Md Sadiqur Rahman
Md Sadiqur Rahman - avatar
+ 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.
12th Apr 2017, 12:16 PM
Kamaljeet S Batth
0
it does not work
10th Apr 2017, 1:49 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar