user5447339 user5447339 - 2 months ago 15
CSS Question

move an image towards the top in css

I have a fiddle in which I want to move an image (keyboard) towards the top so that it looks exactly similar to below design.

enter image description here

In my fiddle, the keyboard image is slightly down as depicted in the fiddle. I am wondering how can I push my keyboard image slightly up so that it looks exactly similar to the above design.

The snippets of my HTML code having keyboard image are :

<div class="full-stack-developer">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-3 left-side">
<a href=""><img src="assets/img/Uploads/keyboard.png" </a></div>
<div class="col-lg-3 right-side"> <a href="">Full Stack Developer</a>
<ul>
<a href=''>
<li>Qualification</li>
</a>
<a href=''>
<li>Go here</li>
</a>
</ul>
</div>
</div>
</div>
</div>


Just checking if it can be done without using
position: relative and position: absolute
?

Answer Source

You can add the margin top -50px to the image.

#id_keyboard {
    margin-top: -50px;
}

https://jsfiddle.net/2bd2zrm9/5/embedded/result/