Align | Sololearn: Learn to code for FREE!

+1

Align

how do i align this image to the middle of the page when i do it it doesnt work

7/7/2017 8:27:31 PM

_Legend27_

4 Answers

New Answer

+16

<body style=margin:0;text-align:center;line-height:100vh> <img src= "http://www.womenofmystery.net/wp-content/uploads/2014/06/hfot_proudsup_400pix.png" alt="Home for Veterans" title="Home for our Troops" height="50px" width="50px"/> </body>

+3

Or just add css 'display:block; margin:auto;' (and better to define image width and height through css also): <img src= "http://www.womenofmystery.net/wp-content/uploads/2014/06/hfot_proudsup_400pix.png" alt="Home for Veterans" title="Home for our Troops" style="height:50px; width:50px; display:block; margin:auto;"> Anyway, as you can see, I have deleted the ending slash (/) of your <img> tag, as it's non valid in Html5 (even if browsers auto correct it easily due to permissivity mandatory in Html5 specification) ;P

0

<img src= "http://www.womenofmystery.net/wp-content/uploads/2014/06/hfot_proudsup_400pix.png" alt="Home for Veterans" title="Home for our Troops" height="50px" width="50px"/>

0

this is the code