<!--
https://recursosfrontend.com/recupera-el-tamano-de-la-ventana-con-solo-css-escalares-con-tan-atan2/
-->
@property --w_raw {
syntax: "<length>";
inherits: true;
initial-value: 100vw;
}
@property --h_raw {
syntax: "<length>";
inherits: true;
initial-value: 100vh;
}
:root {
--w: tan(atan2(var(--w_raw), 1px));
--h: tan(atan2(var(--h_raw), 1px));
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
font-size: 24px;
background-color: #f4f4f4;
}
body::before {
content: counter(w) " x " counter(h);
counter-reset: h var(--h) w var(--w);
background-color: #ff4081;
color: white;
padding: 20px;
border-radius: 8px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.