All described methods of using CSS can be used either alone or in combination with each other. In this case, is necessary to remember their hierarchy.
Strings
Numbers
URLs
Keywords
Colors
Dimensions. Relative units
em, rem, px, %, vw, vh, vmin, vmax
Dimensions. Absolute units
in, cm, mm, pt, pc
Cascading refers simultaneous use of different style rules to document elements by connecting multiple style files, inheritance of properties and other methods.
For each identifier (hereinafter denote the number through a) there are 100 point, for each class and pseudoclass (b) there are 10 point for each tag selectors and pseudoselector (c) there is 1 point. Composing listed values in any particular order, we obtain the weight for the selector
STYLE ---- ID ---- CLASS ---- ELEMENT
background: color image position/size repeat
origin clip attachment initial|inherit;
* {
box-sizing: border-box;
}
.element {
position: static; /* default */
position: relative;
position: absolute;
position: fixed;
}
.element {
float: left;
}
.element {
float: right;
}
http://arvindr21.github.io/howBrowserWorks
http://www.html5rocks.com/ru/tutorials/internals/howbrowserswork/
.element {
float: left;
}
.element {
float: left;
}
.footer {
clear: both;
float: none;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
* html .clearfix { height: 1%; }
.clearfix { display: block; }
overflow: auto | hidden | scroll | visible | inherit;
border-radius: <radius>{1,4} [ / <radius>{1,4}];
border-radius: 10px; border-radius: 10px 20px; border-radius: 10px 20px 10px 20px; border-radius: 10px 20px 10px 20px / 10px 20px 10px 20px;; border-top-left-radius:0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;
box-shadow: none | <shadow> [,<shadow>]*
where <shadow>:
inset? <x shift> <y shift> <blur radius> <length> <color>
linear-gradient(
[ <angle> | to <side-or-corner> ,]? <color-stop> [, <color-stop>]+ )
\---------------------------------/ \----------------------------/
Definition of the gradient line List of color stops
where <side-or-corner> = [left | right] || [top | bottom]
and <color-stop> = <color> [ <percentage> | <length> ]?
linear-gradient( 45deg, blue, red ); /* A gradient on 45deg axis starting blue and finishing red */
linear-gradient( to left top, blue, red); /* A gradient going from the bottom right to the top left starting blue and
finishing red */
linear-gradient( 0deg, blue, green 40%, red ); /* A gradient going from the bottom to top, starting blue, being green after 40%
and finishing red */
@font-face {
font-family: 'MyWebFont';
src: url('myfont.woff2') format('woff2'),
url('myfont.woff') format('woff'),
url('myfont.ttf') format('truetype');
}
@import url(//fonts.googleapis.com/css?family=Open+Sans);
body {
font-family: 'Open Sans', sans-serif;
}
div {
z-index: 1; /* integer */
}}
transition: <property> <duration> <timing-function> <delay>;
transform: <type>;
p {
border: solid red;
-webkit-transform: translate(100px) rotate(20deg);
-webkit-transform-origin: 0 -250px;
transform: translate(100px) rotate(20deg);
transform-origin: 0 -250px;
}
/* @keyframes duration | timing-function | delay |
iteration-count | direction | fill-mode | play-state | name */
@keyframes example {
from {}
to {}
}
@keyframes example {
0% {}
25% {}
50% {}
100% {}
}
/* @keyframes duration | timing-function | delay |
iteration-count | direction | fill-mode | play-state | name */
animation: 3s ease-in 1s 2 reverse both paused slidein;
/* @keyframes duration | timing-function | delay | name */
animation: 3s linear 1s slidein;
/* @keyframes duration | name */
animation: 3s slidein;