Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving a div element left by a few pixels

Tags:

html

css

frontend

I am a newbie in front-end development, so please bear with me if the question is too basic. What I am trying to achieve is very similar to the following problem:

How do I move the search bar on SO's website to the left without affecting the other elements? I can't use the margin-left property since that would move the other elements as well. Is there any way to achieve this? Thanks!

like image 643
Prashant Pandey Avatar asked Sep 14 '25 11:09

Prashant Pandey


1 Answers

You can use margin-left negative + margin-right positive;

margin-left: -10px;
margin-right: 10px;
like image 107
Mike Trinh Avatar answered Sep 17 '25 00:09

Mike Trinh