CSS: Difference between revisions

From Leo's Notes
This page was last edited on 14 March 2015, at 23:47.
Created page with "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>></code> character. {| ! CSS2 ! CSS3 |- | <syn..."
 
mNo edit summary
Line 30: Line 30:
}
}
</syntaxhighlight>
</syntaxhighlight>
|}


Rules can be isolated for certain viewports.
Rules can be isolated for certain viewports.

Revision as of 23:47, 14 March 2015

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
    }
  }
}

Rules can be isolated for certain viewports.


Less

Rules can be inherited with &:extend()

img {
  &:extend(.img-responsive);
}