HTML, CSS and JavaScript
Style Attribute
<div style="..."></div>
Style
<style type="text/css"></style>
Link
<link rel="stylesheet" type="text/css" href="...">
Universal
* { color: #555; }
Type
p{ color: #59dcc5; }
Pseudo Elements
p:first-line{ text-decoration: underline; } p:first-letter{ font-size: 24px; text-transform: uppercase; } :before{ content: '"'; color: #666; } :after{ content: '"'; color: #666; }
Universal < Type = Pseudo Elements
Descendant
div p{ color: #34bee1; }
Child
div > p{ color: #eac532; }
Universal < Type = Pseudo Elements <
Descendant = Child
Adjacent
h1 + div{ color: #0b75f8; }
Pseudo Classes
/*** Postion Based ***/ ul > li:first-child{ font-weight: bold; } /*** Link Based ***/ a:link{ color: #00b168; } a:visited{ color: #1d9a67; } /*** State Based ***/ button:hover{ color:#d7830a; } button:focus{ color:#d2a76a; } button:active{ color:#d5963c; }
Universal < Type = Pseudo Elements <
Descendant = Child = Adjacent = Pseudo Classes
Attribute
input[type]{ border: 1px solid #333; } input[type="text"]{ font-size: 14px; } input[class^="name"]{ border: 1px solid #999; } input[class$="name"]{ border: 1px solid #999; } input[class*="name"]{ border: 1px solid #999; } input[class~="first"]{ border: 1px solid #999; } input[class|="name"]{ border: 1px solid #999; }
Universal < Type = Pseudo Elements <
Descendant = Child = Adjacent = Pseudo Classes =
Attribute
Class
div.example{ color: #6762a9; font-size: 12px; }
ID
div#unique_div{ color: #469dc6; font-size: 15px; }
Inline Styles
<div id="unique_div" style="font: 24px; color: #000;"> .... </div>
Universal < Type = Pseudo Elements <
Descendant = Child = Adjacent = Pseudo Classes =
Attribute = Class < ID < Inline Styles
Name
color: 'black';
Hex
color: #000; color: #000000;
Function
color: rbg(0, 0, 0); color: rbga(0, 0, 0, 0);
%
div{ width: 50%; height: 50%; }
PX
div{ width: 50px; height: 50px; }
EM
div{ width: 2em; height: 2em; }
Want a more indepth look at what was covered?
Display
display: block|inline|inline-block|none(default)|list-item|table
Postion
position: relative|absolute|fixed|static(default) top: px|% left: px|% bottom: px|% right: px|%
Float
float: left|right|none(default) clear: left|right|both|none(default)
/*** Individuals ***/ padding-top: 10px; padding-bottom 10px; padding-left: 10px; padding-right: 10px; /*** Shorthand ***/ padding: 10px 5px 5px 10px; /*** top, right, bottom, left ***/ padding: 10px 10px; /*** top/bottom, left/right ***/ padding: 10px; /*** top/left/right/bottom ***/
/*** Individuals ***/ border-style: none|solid|dotted|dashed|double|groove|ridge|inset|outset|hidden border-top-style: solid; border-bottom-style: dotted; border-left-style: dashed border-right-style: double; border-width: 2px; border-top-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-right-width: 2px; border-color: #666; /*** Shorthand ***/ border-top: 2px solid red; border-bottom: 2px dotted blue; border-left: 2px none green; border-right: 2px dashed black; border: 2px solid black;
/*** Individuals ***/ margin-top: 10px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; /*** Shorthand ***/ margin: 10px 5px 5px 10px; /*** top, right, bottom, left ***/ margin: 10px 10px; /*** top/bottom, left/right ***/ margin: 10px; /*** top/left/right/bottom ***/
/*** Individuals ***/ background-color: none|transparent(default)|#999; background-image: none(default)|url(background.png); background-repeat: repeat(default)| repeat-x|repeat-y|no-repeat; background-attachment: scroll(default)|fixed; background-position: top|left|right|bottom|center|top left(combos)|50%(width) 50%(height); /*** Shorthand ***/ background: #999 url(background.png) no-repeat top left;
h1 ~ div{ color: #aeaeae; } li:nth-last-child(2){ font-weight: bold; } p:first-of-type{ color: blue; } p:last-of-type{ color: blue; } p:nth-of-type(3){ background-color: #999; } p::before, p::after{ content: '"'; font-size: 24px; }Complete List of CSS3 Selectors
div{ transform: scale(2, 2); transform: translate(100px, 100px); transform: rotate(45deg); transform: skew(2, 2); transform: scale(2, 2), skew(1, 2), translate(100px, 100px), rotate(45deg) transform-orign: 10px 10px; }
div{ tranistion-property: background-color; tranistion-duration: 1s; tranistion-timing-function: ease|ease-in|ease-out|ease-in-out|linear; tranistion-delay: 1s; tranistion: background-color 1s ease 1s; background-color: #000; } div:hover{ background-color: #fff; }
@keyframe animate{ 0%{ background-color: #000; } 100%{ background-color: #fff; } } div{ animation-name: animate; animation-duration: 3s; animation-timing-function: ease|ease-in|ease-out|ease-in-out|linear; animation-delay: 1s; animation-iternation-count: 2; animation-direction: alternate|reverse|alternate-reverse|normal(default); animation-fill-out: forwards|backwards|both|none(default); animation: animate 3s ease-in 1s 2 alternate; }