What do these double-dash-prefixed CSS properties do?
A double leading dash is used for defining custom properties. For more information, check out this W3C Spec page.
Example from W3C:
:root {
--main-color: #05c;
--accent-color: #056;
}
#foo h1 {
color: var(--main-color);
}
What are these CSS properties that start with a double-hyphen?
These properties are CSS Variables. You can see more on CSS variables here: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables Here's an example of how to access CSS variables:
element {
background-color: var(--main-bg-color);
}
The reason they are in something called root
: The :root selector allows you to target the highest-level "parent" element in the DOM, or document tree.
What do leading hyphens mean in CSS?
They are vendor specific CSS properties.
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover; /* WEBKIT - Chrome, Safari */
-moz-background-size: cover; /* MOZILLA - Firefox */
-o-background-size: cover; /* OPERA */
background-size: cover;
}
Hypens are used to introduce vendor specific CSS properties, which are used by the browsers but not yet recognized as standard for CSS.
Prefixes often used in CSS are:
Android: -webkit-
Chrome: -webkit-
Firefox: -moz-
Internet Explorer: -ms-
iOS: -webkit-
Opera: -o-
Safari: -webkit-
what does this code snippet do and is it css?
The --
refers to a CSS variable. The entire definition
--slice-0: inset(50% 50% 50% 50%)
is a shorthand for top
, right
, bottom
and / or left
see here. It defines the physical offset of an element relative to its parent component.
Also check CSS custom properties (CSS variables).
Related Topics
Is It Ok to Have Multiple HTML Forms with The Same Name
Django Doesn't Display Newline Character When Rendering Text from Database
Box-Shadow on Ie9 Doesn't Render Using Correct CSS, Works on Firefox, Chrome
How to Check If The Browser Can Play Mp4 via HTML5 Video Tag
How to Hide The Arrow That Is Displayed by Default on The HTML5 <Details> Element in Chrome
Dashed Border Not Showing in Firefox
Send Custom Http Request Header with HTML5 Audio Tag
Progress Bar Made of Solid Line, with Dots as Steps
How to Get The HTML5 Audio's Duration Time
Can a Div Have Multiple Classes (Twitter Bootstrap)
How Position Absolute and Fixed Block Elements Get Their Dimension
Twitter Bootstrap: Column Re-Ordering for Full Width Divs
CSS Selector for No-Children-But-Not-Empty