On Github gcziprusz / graduate_css_strategy
Organizational system
variables, functions(mixins), conditionals and loops
It is a CSS language extension
.SCSS
$primary-color: #333;
body { color: $primary-color; }
.SASS
primary-color: #333
body
color: $primary-color
@mixin respond-to($breakpoint)
@media only screen and (min-width : #{$breakpoint}px)
@content
.nav
width: 100%
+respond-to(600)
width: 50px
float: left
.box{
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.box border-radius: 5pxborder-radius example
decorates/augments CSS with prefixes
long selector chains
incorrect specificity
A methodology tells us how to do stuff
object oriented design ideas
Naming convention
.site-nav {} /* Block */
.site-nav__field {} /* Element */
.site-nav__field--full {} /* Modifier */
Adds meaning to selectors
.person__hand--left {}
.js-widget
.is-hidden
#widget { } /* id */
.widget { } /* class */
widget { } /* element */
Specificity determines which CSS rule is applied by the browsers.
rightmost is the key selector
.nav .nav__block--left {
font-weight: bold;
}
QuerySelector, Local Storage, ClassList, AddEventListener
full experience
no svg icons, no CSS3 effects, no custom fonts
// [doc] Vertically center content. // Use this class on the container and // __inner on the element to be centered. // [/doc] .vertically-centered