+ 1

How to center Images

I'm trying to get an image centered, below u can find an example of a code I'm trying with a picture from google.com, and I added class="center" to img attribute and it ain't do it, also I've tried align="center" and it doesn't get centered!!! <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a heading</h1> <p>My name is methos</p> <img src="https://www.google.com.eg/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" class="center" /> </body> </html> Appreciate your support

22nd Jul 2018, 12:39 PM
Sherif Massoud
Sherif Massoud - avatar
2 Réponses
+ 11
you can use center tag to center the image <center><img src="https://www.google.com.eg/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" class="center" /> </center> or with css .center {     display: block;     margin-left: auto;     margin-right: auto;     width: 50%; }
22nd Jul 2018, 12:43 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 2
HTML : <center> <img src="image.png"/> </center> CSS : img { margin : 0 auto; }
22nd Jul 2018, 12:52 PM
program
program - avatar