W3schools - CSS_Math Function
찾으시는 정보가 있으시다면
주제별reference를 이용하시거나
우측 상단에 있는 검색기능을 이용해주세요
Math functions
Allow mathematical expressions to be as property values
calc() : Allows to perform calculations to determine CSS property values
max() : Uses the largest value, from a comma-separated list of values, as the property value
min() : Uses the smallest value, from a comma-separated list of values, as the property value
Variables
The var()
function is used to insert the value of a CSS variable
Syntax : var(–name, value)
-
name : Required. The variable name(must start with two dashes)
-
value : Optional. The fallback value(used if the variable is not found)
var()
works
CSS variables can have a global or local scope
-
Global var can be accessed/used through the entire document
-
Local variables can be used only used only inside the selector where it is declared
To create a var with global scope, declare it inside the :root
selector
:root
: selector matches the document’s root element
To create a var with local scope, declare it inside the selector that is going to use it
:root{
--blue: #1e90ff;
}
h2{
Color : var(--blue);
}
Media query
@media
rule made it possible to define style rules for different media type