Home
CSS
CSS Centering Images
Tryit: Center an image horizontally
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div { display: flex; justify-content: center; } img { width: 50%; } </style> </head> <body> <h2>Center an Image Horizontally</h2> <div> <img src="paris.jpg" alt="Paris" style="width:50%"> </div> </body> </html>