Absolutely positioned element not behaving as expected

I expect it to stick to the div called flex but it isn't for some reason I've tried debugging In the pen it isn't working at all https://codepen.io/Dev-T/pen/ZEZEaNJ
Tarik
CodePen
Absolute
...
6 Replies
b1mind
b1mind4mo ago
Ya you don't have your button as a child of the .flex relative Also please don't use h1 or any headings for size/style of text. Only for semantic meaning.
ChooKing
ChooKing4mo ago
I don't know which absolutely positioned item you want to control. Article is the parent of flex and press is a sibling of flex's parent. Neither of them are children of flex. The problem is in your HTML, but you probably didn't see it because you only looked in the CSS.
Takir
Takir4mo ago
@ChooKing @b1mind thanks guys I thought since pos:absolute took it out of the flow that it didnt matter if it was the child or not
b1mind
b1mind4mo ago
it does but it looks to the next parent for relative pos. otherwise its going to pull it all the way out to body in your case it was your main
Takir
Takir4mo ago
Thanks!
majkl
majkl4mo ago
Can you plase elaborate? Stick what?