Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Created November 8, 2025 13:04
Show Gist options
  • Select an option

  • Save kobitoDevelopment/39a2395c2ac6bafeb43793e6ae7cd35a to your computer and use it in GitHub Desktop.

Select an option

Save kobitoDevelopment/39a2395c2ac6bafeb43793e6ae7cd35a to your computer and use it in GitHub Desktop.
/* viewportの横幅と高さの実数値を取得する */
@property --viewport-w {
syntax: "<length>";
inherits: true;
initial-value: 100vw;
}
@property --viewport-h {
syntax: "<length>";
inherits: true;
initial-value: 100vh;
}
body {
--calculated-viewport-w: tan(atan2(var(--viewport-w), 1px));
--calculated-viewport-h: tan(atan2(var(--viewport-h), 1px));
background-color: orange;
}
body:before {
content: counter(w) "x" counter(h);
counter-reset: h var(--calculated-viewport-h) w var(--calculated-viewport-w);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment