{"id":8272,"date":"2024-02-09T16:55:02","date_gmt":"2024-02-09T15:55:02","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=8272"},"modified":"2024-09-30T08:13:17","modified_gmt":"2024-09-30T07:13:17","slug":"css-position-sticky","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/css-position-sticky\/","title":{"rendered":"CSS position sticky"},"content":{"rendered":"\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"html\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">&lt;style>\n.parent {\n    position: relative;\n    overflow: auto; \/* or made otherwise scrollable *\/\n}\n\n.with-a-size {\n    display: grid;\n    width: 100%;\n    height: 100%;\n}\n\n.sticky-element {\n    position: sticky;\n    top: 0; \/* !important: first set relative position: top|right|bottom|left *\/\n    z-index: 100; \/* correct to flow above the content scrolled up *\/\n}\n&lt;\/style>\n\n&lt;div class=\"parent with-a-size\">\n    &lt;div class=\"sticky-element\">ABC&lt;\/div>\n    &lt;div class=\"other-elements\">\n        content\n    &lt;\/div>\n&lt;\/div>\n\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8272","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/8272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=8272"}],"version-history":[{"count":2,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/8272\/revisions"}],"predecessor-version":[{"id":8950,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/8272\/revisions\/8950"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=8272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=8272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=8272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}