免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2017年11月19日 星期日

css posiition relative to its parent or not ?

//=== https://stackoverflow.com/questions/10487292/position-absolute-but-relative-to-parent

#father {
position: relative;
}

#son1 {
position: absolute;
top: 0;
}

#son2 {
position: absolute;
bottom: 0;
}
This works because position: absolute means something like "use top, right, bottom, left to position yourself in relation to the nearest ancestor who has position: absolute or position: relative."

If you don't give any position to parent then by default it takes "static"

//===

沒有留言:

張貼留言