Skip to content

Instantly share code, notes, and snippets.

@X-oss-byte
Created September 19, 2023 03:03
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/e63b2ee696dc6467535c1b140825ca7d to your computer and use it in GitHub Desktop.
Save X-oss-byte/e63b2ee696dc6467535c1b140825ca7d to your computer and use it in GitHub Desktop.
HTML containment overflow (1d)

HTML containment & overflow

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. I believe that's a bug.

⬇️
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