Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting css constant() or env() variables in chrome for debugging

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?

like image 824
fsw Avatar asked Feb 15 '19 08:02

fsw


People also ask

How do I see all variables in CSS?

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.

How do I inspect a Javascript variable in Chrome?

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.

How do Environment variables work?

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.

How do you use a safe area inset bottom?

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.


1 Answers

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);
}
like image 89
fsw Avatar answered Sep 30 '22 20:09

fsw