CSS Margin Negative without moving the parent container

I'm trying to get to this page ( http://musicaladvocacy.org/ ) in the area where it says "Home" (White Container in a gray gradient) to go ~ 60 pixels up, but as you can see, it does this. and also moves the parent container up. I just want the white box to move up, and not all. Therefore, it should look like this: http://musicaladvocacy.org/index-margin.jpg

Thanks for any ideas!

+3
source share
3 answers

You can apply position:relative; top:-60px;to the item you want to move.

#el {
   position:relative;
   top:-60px;
   z-index: 5;
}
+13

1px .

.width { padding-top: 1px; }
.content { margin-top: -60px; }

, , , .

+8

What you are looking for are the css properties "position" and "top".

#div-1 {
  position:relative;
  top:-60px;
}

See step 2 in this guide . Many other websites have additional information about these properties.

+1
source

Source: https://habr.com/ru/post/1677638/


All Articles