Exploring the Enigmatic Double-Dash CSS Properties
You may have encountered a peculiar CSS code featuring property names prefixed with double dashes. These are not regular CSS properties but custom properties introduced in CSS3.
Understanding Custom Properties
Custom properties, also known as CSS variables, allow you to define and reuse values throughout your stylesheet. They enable flexibility and maintainability by centralizing design elements.
Syntax and Use
Custom properties are declared within the root element (:root) using the following syntax:
:root { --property-name: property-value; }
You can then access the custom property value within any element using the var() function:
#element { color: var(--property-name); }
Example from W3C:
:root { --main-color: #05c; --accent-color: #056; } #foo h1 { color: var(--main-color); }
This example defines custom properties for the main and accent colors and uses the color value variable within the #foo h1 selector.
Reference and Documentation
For comprehensive documentation on custom properties, refer to the W3C Spec page:
https://www.w3.org/TR/css-variables/
The above is the detailed content of What are Double-Dash CSS Properties and How Do They Work?. For more information, please follow other related articles on the PHP Chinese website!

Here's a container with some child elements:

Flyout menus! The second you need to implement a menu that uses a hover event to display more menu items, you're in tricky territory. For one, they should

"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."- Tim Berners-Lee

In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.

The short answer: flex-shrink and flex-basis are probably what you’re lookin’ for.

In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties

The IndieWeb is a thing! They've got a conference coming up and everything. The New Yorker is even writing about it:


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Atom editor mac version download
The most popular open source editor

Zend Studio 13.0.1
Powerful PHP integrated development environment