Learn HTML
CSS Introduction
CSS Basic Syntax
CSS Selector
CSS Units
CSS Text
CSS Border
CSS Outline
CSS Padding
CSS Margin
CSS Height & Width
CSS Overflow
CSS Resize
CSS Background
CSS Box Sizing
CSS Position
CSS Float
CSS Clear
CSS Clip Path & Shape Outside
CSS Display
CSS Media Queries
CSS Pseudo Classes & Elements
CSS Filter
CSS Transition
CSS Transform
CSS Animation
CSS List Style
CSS Table
CSS Scrollbar Styling
CSS Icon
CSS Cursor
CSS Variable & Calc
CSS User Select
CSS Flexbox
Learn Javascript
Learn Django
Suppose we used red color in five place. Now if we want to change red color into green color then normally we
have to go to each place where we wrote red and then have to remove red color and type green color. This thing
takes a lot of time. What if we create a variable and then write red color inside that variable and then to
give color, previously where we wrote red there we will write the variable name. Now if we need to change the
red into green then we don't need to go to each place, we have to just go to the variable and there we have to
remove red and then write green. If we do that then each place red will change into green.
How to write variable?
:root{
--variable_name:value;
}
How to use variable?
.first{
color:var(--variable_name);
}
You can not give space between variable name. You can use under score.
We can create multiple variable inside root.
How to write variable:
:root{
--variable_name_1:value;
--variable_name_2:value;
}
For doing mathematical calculation we use calc() function. Suppose we want to set a box width and that is from
total width of screen we want 50px less. But we don't know the total width of screen.
In this case we can write
Width:calc(100%-50px);
It's means take 50px less from total width of the screen. The calculation will be done by the calc()
function
Some other examples are:
Background-position:calc(100%-50px) calc(100%-2px);
font-size:calc(100%-200px);
border:calc(50-40) red solid;