I have CSS like:
#something {
top: 0;
top: constant(safe-area-inset-top);
top: env(safe-area-inset-top);
}
(that changes view on mobile browser)
Is there a way to set safe-area-inset-top
value as constant
or env
variable in chrome on desktop to debug/tests?
Select any element, scroll down to the bottom of the Styles tab and find :root , where all your variables are defined. You can change any variable value here and the changes will be updated across your whole page.
Click F12 to open Developer Tools in Chrome. Or we can right-click and select Inspect (Ctrl+Shift+I). Go to Sources tab and expand Event Listener Breakpoints section. We can find different events listed in the section like Keyboard, Device, Mouse, etc.
An environment variable is a dynamic "object" on a computer, containing an editable value, which may be used by one or more software programs in Windows. Environment variables help programs know what directory to install files in, where to store temporary files, and where to find user profile settings.
On the desktop safe-area-inset-bottom is 0 . However, in devices that display notifications at the bottom of the screen, such as iOS, it contains a value that leaves space for the notification to display. This can then be used in the value for padding-bottom to create a gap that appears natural on that device.
Maybe better answer will come but for now the best I found is to simply use variables as a workaround:
:root {
--safe-area-inset-top: 20px;
}
#something {
top: 0;
top: constant(safe-area-inset-top);
top: env(safe-area-inset-top);
top: var(--safe-area-inset-top);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With