CSS: Difference between revisions
From Leo's Notes
This page was last edited on 24 February 2017, at 19:14.
m Text replacement - "<code>" to "{{code|" |
m Text replacement - "</code>" to "}}" |
||
| Line 1: | Line 1: | ||
Things have change a lot since the last few years. Here are my quick notes on using CSS3. | Things have change a lot since the last few years. Here are my quick notes on using CSS3. | ||
CSS can now be nested using the {{code|> | CSS can now be nested using the {{code|>}} character. | ||
{| | {| | ||
! CSS2 | ! CSS2 | ||
| Line 39: | Line 39: | ||
== Less == | == Less == | ||
Rules can be inherited with {{code|&:extend() | Rules can be inherited with {{code|&:extend()}} | ||
<syntaxhighlight lang="css"> | <syntaxhighlight lang="css"> | ||
Revision as of 19:14, 24 February 2017
Things have change a lot since the last few years. Here are my quick notes on using CSS3.
CSS can now be nested using the > character.
| CSS2 | CSS3 |
|---|---|
.outside .inside {
# Styles A
}
.outside .inside img {
# Styles B
}
.outside .inside p {
# Styles C
}
|
.outside {
> .inside {
# Styles A
> img {
# Styles B
}
> p {
# Styles C
}
}
}
|
The nesting must be immediate. It will not be inherited if the path does not match completely.
Rules can be isolated for certain viewports.
Less
Rules can be inherited with &:extend()
img {
&:extend(.img-responsive);
}