htmlcssweb

How do I reposition my image to the right with HTML and CSS?


I need to move my image a bit to the right, but not fully. This is what I currently have, and this is how I need it to look like.

This is the code I have for the image currently:

<div>
  <img src="../Hozier.png" width="245" height="600">
</div>

I am very new to HTML and really need some help. Thank you in advance.


Solution

  • You can add margin to the left side of the img element with CSS.

    <div style="margin-left: 100px;"><img src="../Hozier.png" width="245" height="600"></div>
    

    You can change the 100px value to move the image to the right more or less as needed.