Skip to content

Instantly share code, notes, and snippets.

@X-oss-byte
Created August 3, 2023 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save X-oss-byte/e958ccac6e0cfe72fe6a39091428f82d to your computer and use it in GitHub Desktop.
Save X-oss-byte/e958ccac6e0cfe72fe6a39091428f82d to your computer and use it in GitHub Desktop.
HTML containment overflow (1d)
<h1>HTML containment & overflow</h1>
<p>
There should be a fixed-position arrow
in the top right,
and it should stay in the top right,
attached to the viewport
as you scroll down to see the rainbow.
But no browser allows it.
<a href="https://github.com/w3c/csswg-drafts/issues/9003">I believe that's a bug.</a>
</p>
<div class="fixed">⬇️</div>
<div class="spacer"></div>
html {
container-type: inline-size;
}
@layer setup {
html {
font-size: calc(1.5em + 1vw);
}
.fixed {
position: fixed;
top: 1em;
right: 1em;
padding: 1em;
background: hsl(0deg 0% 50% / 0.5);
border: thick double white;
}
.spacer {
height: 300vh;
background: linear-gradient(
to bottom,
red,
orange,
yellow,
green,
blue,
indigo,
violet
);
padding: 1em;
text-align: center;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment