+ 3
How to align an image to the center of the page?
I want to put an image at the center of my website. How do I do that? Because when I try, nothing happens Here's an example: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <img align="center" src="https://images.indianexpress.com/2017/03/books_thinkstock_759.jpg" alt="A book" /> </body> </html>
6 ответов
+ 2
A few ways you can do this. Whatever you do you should probably wrap it in div tags.
Look at adding auto left-right margins and using 50% top margin with translate y -50%
You can also use display table and table cell to vertically align elements,
Also you can do this with both flex and grid.
Also DO NOT use <center> it's a non-supported tag in HTML 5 and may be removed / stop working in any browser with no notification.
+ 6
Using align center on images won't work. IF you want to use it then center a div or a p and place the img inside of it.
<div align="center"><img></div>
+ 2
Also DO NOT use <center> it's a non-supported tag in HTML 5 and may be removed / stop working in any browser with no notification.
+ 2
Try doing that in CSS.
0
Use center tag if you want to align it in center or use div element