-1

I got that If I use child's position as relative, I can move child's position attached to parent. like this:

#child{
  position: relative;
  left: 30px;  }

Sometimes I see that parent's position is relative, and child's position is absolute. like this.

 #parent{
  position: relative;

  }
 #child{
  position: absolute;
  left: 30px;
  }

But what's different with this two?

YESSS
  • 11
  • 3

1 Answers1

0

Both are positioned relative to the nearest positioned ancestor.

The difference being, child with position: absolute is removed from the normal flow.

bitski
  • 1,168
  • 1
  • 13
  • 20