B.Gh B.Gh - 8 days ago 6
HTML Question

How to move an image upwards in html/css



I'm quite new to HTML and I wanted to have an image in my page, but when I use

<hr>
to separate it from other stuff they cross each other. So I want to move my image up a little. Here's the code I've been using:

<html dir="rtl"> <body> ... <img src="20161125_041749.jpg" alt="my pic" style= "width: 108px; height: 130px; float:left;" ... </div> </body> </html>


I'm not using
<head>
nor
<style>
tags.

I've been trying to use position:relative;top:-10px; ,but I can't figure out how to use it or it has some problem with the "float".
Coud anyone please help me what to do?

Thanks in advance and Thanks to all who have tried to solve it so far...

Answer

change the value of top as you needed

#img{
  position: relative;
  top:-10px;
  }
<img src="https://i.stack.imgur.com/W1bSf.jpg" alt="my pic" style= "width: 108px; height: 130px; float:left;" id="img">

Comments