Ravi Kumar Profile picture
Web Developer | Technical Writer @lambdatesting | Sharing β€’ Web Dev Tips β€’ resources β€’ AI β€’ No-code tools β€’ | DM for Collaboration

Jul 27, 2021, 7 tweets

CSS variable

know everything about CSS variable

πŸ§΅πŸ§΅πŸ‘‡πŸ‘‡

01. Intro of a CSS variable

It is a custom property of a CSS that is defined by a CSS author that contains some specific values that are reusable through a document.

it is used in the google chrome browser

see exampleπŸ‘‡πŸ‘‡

02. Syntax or how to use

πŸ‘‡πŸ‘‡

:root{
--color-primary: #001f3f;
}

p {
color: var(--color-primary);
}

03. use case of a CSS variable

1. colors
2. font sizes
3. SVG
4. Grid layouts
5. column proportions
6. Buttons

04. TipπŸ’‘πŸ’‘

always defined variable in root section because it gives you global reach through your entire Html document

you can define it in the Html section also so it can be
treated as a global variable.

05. conclusion

So many good uses, and we’re barely getting started Use the comments to ask follow-up questions or share your ideas for using CSS custom properties (variables).

Thank you for reading the full thread. If you like this thread

Hit β™₯️
retweetπŸ”
comment πŸ“Ÿ
follow me πŸ‘ˆπŸ‘ˆ

share this full thread for more reach

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling