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
b1mindβ€’10mo 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.
Chooβ™šπ•‚π•šπ•Ÿπ•˜
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
TakirOPβ€’10mo 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
b1mindβ€’10mo 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
TakirOPβ€’10mo ago
Thanks!
majkl
majklβ€’10mo ago
Can you plase elaborate? Stick what?
Want results from more Discord servers?
Add your server