$
$color: #0982c1;
$width: 1024px;
$style: dotted;
body {
color: $color ;
border: 1px $style $color ;
max-width: $width ;
}
CSS output
body {
color : #0982c1;
border : 1px dotted #0982c1;
max-width : 1024px;
}"You are what you do, not who you are"
* {
margin: 0;
padding: 0;
}
nav * {
border: 1px solid black;
}
Universal selector (Level 2)
p {
margin: 0;
padding: 0;
}
.sidebar h1 {
border: 1px solid black;
}
Type selector (Level 1)
a[href] {
background: #666;
padding-left: 10px;
}
Attribute selectors (Level 2)
a[data-info~="external"] { color: red; } a[data-info~="image"] { border: 1px solid black; }
Attribute selectors (Level 2)
a[href^="http"] {
background: #333;
padding-left: 10px;
}
Attribute selectors (Level 3)
a[href$=".rar"] {
color: red;
}
Attribute selectors (Level 3)
a[href*="naknak"] {
color: #1f6053;
}
Attribute selectors (Level 3)
a[href|="nak"] {
color: #1f6053;
}
Attribute selectors (Level 2)
a:root {
color: #1f6053;
}
Structural pseudo-classes (Level 3)
li:nth-child(3) {
color: red;
}
Structural pseudo-classes (Level 3)
p img:nth-of-type(3) {
border: 1px solid black;
}
Structural pseudo-classes (Level 3)
ul:nth-last-of-type(3) {
border: 1px solid black;
}
Structural pseudo-classes (Level 3)
ul li:first-child {
border-top: none;
}
Structural pseudo-classes (Level 2)
li:nth-last-child(2) {
color: red;
}
Structural pseudo-classes (Level 3)
.foo img:first-of-type{
border-top: none;
}
Structural pseudo-classes (Level 3)
.foo img:last-of-type{
border-top: none;
}
Structural pseudo-classes (Level 3)
article p:only-child {
color: red;
}
Structural pseudo-classes (Level 3)
li:only-of-type {
font-weight: bold;
}
Structural pseudo-classes (Level 3)
p:empty {
display:none;
}
Structural pseudo-classes (Level 3)
a:link { color:#333; } a:visited { color:#666; }
The link pseudo-classes (Level 1)
a:active { color:#333; } a:hover { color:#666; } a:focus { color:#000; }
The user action pseudo-classes (Level 1&2)
http://example.com/html/top.html#section_2 *:target { color : red } *:target::before { content : url(target.png) }
Here, the :target pseudo-class is used to make the target element red and place an image before it, if there is one:
The target pseudo-class (Level 3)
Hau eukaraz da.
The :lang() pseudo-class (Level 2)
input:disabled{
opacity:.6;
}
The UI element states pseudo-classes (Level 3)
input[type=radio]:checked {
border: 1px solid black;
}
The UI element states pseudo-classes (Level 3)
p::first-line { text-transform: uppercase }
The ::first-line pseudo-element (Level 1)
p::first-letter { color: green; font-size: 200% }
The ::before pseudo-element (Level 2)
.foo::before {
content: "some text";
display: block;
width: 100px;
height: 100px;
background: pink;
}
The ::before pseudo-element (Level 2)
.foo::after {
content: "some text";
display: block;
width: 100px;
height: 100px;
background: pink;
}
The ::before pseudo-element (Level 2)
.warning {
display: block;
width: 100px;
height: 100px;
background: pink;
}
Class selectors (Level 1)
#myid {
display: block;
width: 100px;
height: 100px;
background: pink;
}
ID selectors (Level 1)
div:not(.container) {
color: blue;
}
Negation pseudo-class (Level 3)
header h1{ font-size:2em; color:#333; }
Descendant combinator (Level 1)
header > ul{
font-size:2em;
color:#333;
}
Child combinator (Level 2)
header + h1{
font-size:2em;
color:#333;
}
Adjacent sibling combinator (Level 2)
header ~ h1{
font-size:2em;
color:#333;
}
General sibling combinator (Level 3)
box-sizing: content-box | border-box | inherit;
*{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
resize: none|both|horizontal|vertical|inherit;
In the cosmos, there is no refuge from changeCarl Sagan
.three-col { column-count: 3; column-gap: 20px; column-rule-color: #ccc; column-rule-style:solid; column-rule-width: 1px; }
background-image: url(flower.png), url(ball.png), url(grass.png); background-position: center center, 20% 80%, top left, bottom right; background-origin: border-box, content-box; background-repeat: no-repeat;
* Each of the images is sized, positioned, and tiled according to the corresponding value in the other background properties. The lists are matched up from the first value: excess values at the end are not used. If a property doesn't have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.
background-size: length|percentage|cover|contain;
border-*-*-radius: [ <length> | <%> ] [ <length> | <%> ];
border-top-left-radius: 50px 50px;
box-shadow: inset 2px 2px 20px #333;
rbga (red,green,blue,opacity);
.foo{ color: rgba (255,255,255,.5); }
hsl(hue,saturation,lightness)
background-color: hsl(360,100%,20%);
.foo { opacity: 0.5; }
Value betwen 0 and 1
@font-face { font-family: Gentium; src: url(http://example.com/fonts/Gentium.woff); }
p { font-family: Gentium, serif; }
<gradient> = [ <linear-gradient> | <radial-gradient> | <repeating-linear-gradient> | <repeating-radial-gradient> ]
background: linear-gradient(left, transparent 0%,#444 50%,transparent 100%);
background: radial-gradient(ellipse at center, #ff99cd 0%,#ef017c 100%);
background: #444; background: -webkit-gradient(linear, left top, right top, color-stop(0%,transparent), color-stop(50%,#444), color-stop(100%,transparent)); background: -webkit-linear-gradient(left, transparent 0%,#444 50%,transparent 100%); background: -moz-linear-gradient(left, transparent 0%, #444 50%, #transparent 100%); background: -ms-linear-gradient(left, transparent 0%,#444 50%,#transparent 100%); background: -o-linear-gradient(left, transparent 0%,#444 50%,transparent 100%); background: linear-gradient(left, transparent 0%,#444 50%,transparent 100%);
object-fit: fill | contain | cover | none | scale-down
object-position: 50% 50%;
filter: efect();
blur | grayscale | drop-shadow | sepia | brightness | contrast | hue-rotate | invert | saturate | opacity
<blend-mode> = normal | multiply | screen | overlay | darken | lighten | color-dodge |color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity
<blend-mode> = normal | multiply | screen | overlay | darken | lighten | color-dodge |color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity
Must be applied in the same order as background-image. The first element in the list will apply to the layer that is on top. If a property doesn’t have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.
div { width: 200px; height: 200px; background-size: 200px 200px; background-repeat:no-repeat; background-image: linear-gradient(to right, #000000 0%,#ffffff 100%), url('arale.png'); background-blend-mode: difference, normal; }
transform: transform-function; /* can list multiple, space-separated */
div { -webkit-transform: value; -moz-transform: value; -ms-transform: value; -o-transform: value; transform: value; }
transform: scale(2,3);
transform: rotate(45deg);
transform: skew(45deg);
tranform: translate(x,y);
transform: translate(100px,40px;)
.foo { transition: [transition-property] [transition-duration] [transition-timing-function] [transition-delay]; }
div { transition: background 0.2s ease,padding 0.8s linear; }
div {
transition: background 0.2s ease,padding 0.8s linear;
}
transition-property:background,padding;
div {
transition: background 0.2s ease,padding 0.8s linear;
}
transition-duration: .2s;
div {
transition: background 0.2s ease,padding 0.8s linear;
}
transition-timing-function:ease,linear;
div {
transition: background 0.2s ease 5s,padding 0.8s linear;
}
transition-delay:5s, 0 ;
transition: background 2s ease-out;
transition: border .5s ease-out;
@keyframes resize { 0% { padding: 0; } 50% { padding: 0 20px; background-color:rgba(255,0,0,0.2); } 100% { padding: 0 100px; background-color:rgba(255,0,0,0.9); } } #box { animation-name: resize; animation-duration: 1s; animation-iteration-count: 4; animation-direction: alternate; animation-timing-function: ease-in-out; }
@media screen and (min-width:600px){ body{background: pink; }
Call from <head>
<link rel='stylesheet' media='screen and (min-width: 701px) and (max-width: 900px)' href='css/medium.css' />
Inside the CSS file
@media screen { body {width: 75%; } } @media print { body {width: 100%; } }
@media all and (max-width: 699px) and (min-width: 520px), (min-width: 1151px) { background: #ccc; }
content is kingBill Gates 1996
.img{ max-width: 100%; }
<picture> <source srcset="med.jpg 1x, med-hd.jpg 2x" media="(min-width: 40em)" /> <source srcset="sm.jpg 1x, sm-hd.jpg 2x" /> <img src="fallback.jpg" alt="" /> </picture>
<h1><img alt="The Breakfast Combo" src="banner.jpeg" srcset="banner-HD.jpeg 2x, banner-phone.jpeg 320w, banner-phone-HD.jpeg 320w 2x"> </h1>
.video { max-width: 100%; height: auto; }[with JS]
<video controls> <source src="parrots-small.mp4" type="video/mp4" media="all and (max-width:480px)"> <source src="parrots-small.webm" type="video/webm" media="all and (max-width:480px)"> <source src="parrots.mp4" type="video/mp4"> <source src="parrots.webm" type="video/webm"> </video>
<iframe>
<style> .embed-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden; max-width: 100%; height: auto; } .embed-container iframe, .embed-container object, .embed-container embed{ position:absolute; top: 0; left: 0; width: 100%; height: 100%; } </style> <div class='embed-container'><iframe src='http:http://www.youtube.com/embed/vqSo-iZ5D8E' frameborder='0' allowfullscreen></iframe></div>
.foo{ background-color: #ccc; /* old browsers */ background-color: rgba(0,0,0,0.2); /* supported browsers */ }
background: $color2; /* Old browsers */ background: -moz-linear-gradient(left, $color1 0%, $color2 75%, $color3 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(0%,$color1), color-stop(75%,$color2), color-stop(100%,$color3)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, $color1 0%,$color2 75%,$color3 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, $color1 0%,$color2 75%,$color3 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(left, $color1 0%,$color2 75%,$color3 100%); /* IE10+ */ background: linear-gradient(to right, $color1 0%,$color2 75%,$color3 100%); /* W3C */
Its like adding steroids
|– base/ | |– _reset.scss # Reset/normalize | |– _typography.scss # Typography rules | ... # Etc… | |– components/ | |– _buttons.scss # Buttons | |– _carousel.scss # Carousel | |– _cover.scss # Cover | |– _dropdown.scss # Dropdown | |– _navigation.scss # Navigation | ... # Etc… | |– helpers/ | |– _variables.scss # Sass Variables | |– _functions.scss # Sass Functions | |– _mixins.scss # Sass Mixins | |– _helpers.scss # Class & placeholders helpers | ... # Etc… | |– layout/ | |– _grid.scss # Grid system | |– _header.scss # Header | |– _footer.scss # Footer | |– _sidebar.scss # Sidebar | |– _forms.scss # Forms | ... # Etc… | |– pages/ | |– _home.scss # Home specific styles | |– _contact.scss # Contact specific styles | ... # Etc… | |– themes/ | |– _theme.scss # Default theme | |– _admin.scss # Admin theme | ... # Etc… | |– vendors/ | |– _bootstrap.scss # Bootstrap | |– _jquery-ui.scss # jQuery UI | ... # Etc… | | `– main.scss # primary Sass file
SCSS
$blue: #3bbfce ;SASS
$blue: #3bbfce;Variables
Mixins
Nesting
InheritanceImports
Color functions
Operations
Functions
$color: #0982c1;
$width: 1024px;
$style: dotted;
body {
color: $color ;
border: 1px $style $color ;
max-width: $width ;
}
body {
color : #0982c1;
border : 1px dotted #0982c1;
max-width : 1024px;
}@mixin error ($width: 2px) {
border: $width solid #F00;
color: #F00;
}
.generic-error {
padding: 20px;
@include error () ;
}
.login-error {
width:100px;
@include error (5px) ;
}.generic-error {
padding : 20px;
border : 2px solid #f00;
color : #f00;
}
.login-error {
width :100px;
border : 5px solid #f00;
color : #f00;
}section {
margin : 10px;
nav {
height : 25px;
a {
color : #0982C1;
& :hover {
text-decoration : underline;
}
}
}
}section {
margin : 10px;
}
section nav {
height : 25px;
}
section nav a {
color : #0982C1;
}
section nav a :hover {
text-decoration : underline;
}.block {
margin: 10px 5px;
padding: 2px;
}
p {
@extend .block ;
border: 1px solid #EEE;
}
ul, ol {
@extend .block ;
color: #333;
}.block, p, ul, ol {
margin : 10px 5px;
padding : 2px;
}
p {
border : 1px solid #EEE;
}
ul, ol {
color : #333;
}/* file .scss */
body {
background: #EEE;
}
@import "reset.css" ;
@import "file" ;
p {
background: #0982C1;
}@import "reset.css" ;
body {
background: #EEE;
}
p {
background: #0982C1;
}lighten ( @color , 10%); /*10% lighter than @color */
darken ( @color , 10%); /*10% darker than @color */
saturate ( @color , 10%); /*10% more saturated than @color */
desaturate ( @color , 10%); /*10% less saturated than @color */
$color : #0982C1;
h1 {
background: $color ;
border: 3px solid darken( $color , 50%) ;
}
$width :960px;
$items :6;
body {
margin: (14px / 2);
top: 50px + 100px;
right: 100px - 50px;
left: 10 * 10;
}
p {width: $width / 2;}
li {
float: left;
width:
$width
/
$items
-
10px;
padding:0 5px;
}
body #container .someclass ul li {....} Wrong
.someclass li {...}Correct
with ♡ by
naiara abaroa
Engine used: http://lab.hakim.se/reveal-js