0
How can I put the image in center
<html> <head> <title>first page</title> </head> <body> <img src="http://www.sololearn.com/images/tree.jpg" height="150px" width="150px" alt="" /> <br /> <img src="http://www.sololearn.com/images/tree.jpg" height="50%" width="50%" alt="" /> </body> </html>
4 Réponses
+ 6
<html>
    <head>
        <title>first page</title>
    </head>
    <body> 
    <div align="center">
        <img src="http://www.sololearn.com/images/tree.jpg" 
        height="150px" width="150px" alt="" />
        </div>
        <br />
        <img src="http://www.sololearn.com/images/tree.jpg" 
        height="50%" width="50%" alt="" />
    </body>
</html>
you can wrap each or both images in another div with align="center"
you can also place the align="center" in the body tag, so everything is centered
+ 6
align="center" property should do it!
+ 3
A more simple way of centering a image is 
<center> </center> just put these on the out side ex:
<html>
    <head>
        <title>first page</title>
    </head>
    <body> 
       <center> <img src="http://www.sololearn.com/images/tree.jpg" 
        height="150px" width="150px" alt="" /></center>
        <br />
        </center><img src="http://www.sololearn.com/images/tree.jpg" 
        height="50%" width="50%" alt="" /></center>
    </body>
</html>
It makes your life alot more simple. hope i helped :)
+ 1
html
img id="imag" src="http...
css
#imag{
      width: 50%;
      heigth: auto;
      margin-left: 25%;
}



