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
6 Replies
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.
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.
@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
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
Thanks!
Can you plase elaborate? Stick what?