0

How can I center an image and make it the same width as the text below it?

I want my image to be the same length across as the text that is underneath it.

1st Sep 2019, 4:01 AM
Kayla Torrez
Kayla Torrez - avatar
3 Respuestas
+ 2
Maybe this will help: <html> <head> <style> img { width: 200px; height: 300px; display: block; margin-left: auto; margin-right: auto; } p { text-align: center; } </style> </head> <body> <img src="url" alt="" /> <p>some text who explain the picture above</p> </body> </html>
25th Oct 2019, 11:24 AM
Ilinka Panovska
+ 1
Could you show us an example ? Maybe making the image as background to the text might help but I'm not sure if that's what you want. If you have some code I could probably help you out a bit or just be a little more specific if this don't help. Please do ask if u still need help. Good luck
1st Sep 2019, 5:00 AM
Minerals2016
Minerals2016 - avatar
0
I'm very new to coding and css in particular. I would like to know how to get an image to be at the center of the page. I can't really find where it talks about this anywhere. In html you can center text with <p align="center"> but that same method doesn't work for img tag. I just want my picture to show up in the middle of the webpage.
1st Sep 2019, 9:40 AM
Kayla Torrez
Kayla Torrez - avatar