+ 4

How to put a picture at the center of the screen

23rd Oct 2016, 1:43 PM
Erwann
Erwann - avatar
8 odpowiedzi
+ 8
Use this code : <p align="center"><img src="myimage.jpg"></p> .. This will help :) .. Please do upvote if you got your answer
23rd Oct 2016, 4:29 PM
Rajdip Saha
Rajdip Saha - avatar
+ 7
align="center" valign="middle"
6th Jun 2017, 8:13 AM
Iwan
Iwan - avatar
+ 4
#test{ display:block; margin-right:auto; margin-left:auto; }
23rd Oct 2016, 2:02 PM
Brian
+ 4
<!DOCTYPE html> <html> <style> #test{ display:block; margin-right:auto; margin-left:auto; } </style> <head> <title>Page Title</title> </head> <body> <img src="test.jpg" alt="" id="test"> </body> </html>
23rd Oct 2016, 2:25 PM
Brian
+ 4
Align=center works but people are now moving to using CSS instead of align=center. The reason I suggest CSS is because align=center might not work on some browser in the future.
23rd Oct 2016, 2:34 PM
Brian
+ 4
Just use margin: auto; in CSS, you could also go with the margin-left: auto; and margin-right: auto; that everyone else is saying, they both work pretty much the same.
23rd Oct 2016, 4:08 PM
Brandon Gonzales
Brandon Gonzales - avatar
+ 4
I couldnt get it to work unless u make it a block element.
23rd Oct 2016, 4:12 PM
Brian
+ 3
Where I put this
23rd Oct 2016, 2:10 PM
Erwann
Erwann - avatar