Codrops is a web design and development blog that publishes articles and tutorials about the latest web trends, techniques and new possibilities. The team of Codrops is dedicated to provide useful, inspiring and innovative content that is free of charge.
Tag: CSS
BEM — Block Element Modifier is a methodology
BEM — Block Element Modifier is a methodology that helps you to create reusable components and code sharing in front-end development
http://getbem.com/introduction/
Also read: Why BEM? (in a nutshell)
CSS Wizardry
217 post on this site, mostly covering CSS, architecture, performance, and web development. Find a reverse-chronological list of them all here.
The State Of CSS 2019
We’ve surveyed over 10,000 developers in this first ever State of CSS survey. So join us to find out which CSS features are used the most, which tools are gaining adoption, and much more.
What are CSS Modules and why do we need them?
#What are CSS Modules?
According to the repo, CSS modules are:
CSS files in which all class names and animation names are scoped locally by default.
So CSS Modules is not an official spec or an implementation in the browser but rather a process in a build step (with the help of Webpack or Browserify) that changes class names and selectors to be scoped (i.e. kinda like namespaced).
Styling SVG <use> Content with CSS
Takeaway:
Use css variables (or custom properties) to get access to the svg in the shadow DOM.
https://caniuse.com/#feat=css-variables
Example:
Read MoreGrid – Can I use?
Grid in IE10/11
Shows which parts of Grid you can use or not with IE10/11 when using the autoprefixer. Quite a lot
Know it all
A big list of all the props, values, methods, functions, interfaces, modules, constants, constructors, events, attributes, parameters, return values, variables, elements, statements, operators, declarations, types, primatives, selectors and units of all the APIs related to web development.
Source: Know it all
SASS tips and tricks
watch and build:
sass --watch scss:styles
@if
p {
@if 1 + 1 == 2 { border: 1px solid; }
@if 5 < 3 { border: 2px dotted; }
@if null { border: 3px double; }
}
@for
@for $i from 1 through 3 {
.item-#{$i} { width: 2em * $i; }
}
@each
@each $animal in puma, sea-slug, egret, salamander {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
}
}
@each $animal, $color, $cursor in (puma, black, default),
(sea-slug, blue, pointer),
(egret, white, move) {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
border: 2px solid $color;
cursor: $cursor;
}
}
@each $header, $size in (h1: 2em, h2: 1.5em, h3: 1.2em) {
#{$header} {
font-size: $size;
}
}
@while
$i: 6;
@while $i > 0 {
.item-#{$i} { width: 2em * $i; }
$i: $i - 2;
}
Mixins
Variable Arguments
@mixin box-shadow($shadows...) {
-moz-box-shadow: $shadows;
-webkit-box-shadow: $shadows;
box-shadow: $shadows;
}
.shadows {
@include box-shadow(0px 4px 5px #666, 2px 6px 10px #999);
}
flag-icon-css
A collection of all country flags in SVG — plus the CSS for easier integration.
Source: flag-icon-css