Q:
Why did the hot girl at the bar ignore the HTML page?
A: Coz it didn't have <style> !!
Why so awesome ?
Rounded Corners
Web Fonts
Transitions and Transforms
Shadows
Media Queries
Selectors
Whats next ?
@font-face
Use any custom font on web pages
Font downloaded and rendered on user's box
Format wars - Embedded Open Type (EOF), Web Open font format(WOFF), Open Type(OTF), True Type(TTF)
Font can also be a data:// URI
@font-face {
font-family: MyName ;
src: url('
img/Kingthings_Italique.ttf
http://www.fontsquirrel.com/site_resources/themes/default_theme/css/fonts/megalopolisextra-webfont.woff
http://www.opentype.info/demo/fonts/Diavlo_BLACK_II_37.otf
http://www.opentype.info/demo/fonts/pykes_peak_zero.otf
');
}
<span style ="font-family:MyName ">
This is in a default font
</span>
Animations (Transitions)
div{
background-color: #ABCDEF;
transition-property: background-color;
transition-duration: 3s;
}
div:hover{
background-color: blue;
}
div{
transition-property: left;
transition-duration: 3s;
}
div:hover{
left: -3em;
}
Shadows
div{
box-shadow:3px 3px 5px #000;
-moz-box-shadow:3px 3px 5px #000;
-webkit-box-shadow:3px 3px 5px #000;
}
div {
text-shadow: text-shadow:3px 3px 0px GRAY;
}
Media Queries
@media all and (min-width: 480px) and (max-width: 800px) {
#container {width: auto; max-width: 800px;}
#main {width: 70%; float: left;}
#sidebar {width: 29%; float: left; margin-bottom: 10px;}
#pub {width: 29%; margin-left: 70%; float: none;}
}
@media all and (max-width: 480px) {
#container, #main, #sidebar {width: 100%; font-size: 0.9em;}
#pub {display: none;}
#sidebar ul li {display: inline;}
*{clear: both; border-left: 0 !important; border-right: 0 !important;}
}
Courtsey: Shewtank
Selectors
//Matches anchors elements which link to wikipedia
a[href="www.wikipedia.org" ]{
text-decoration: underline;
}
//Matches all images whose ALT attribute start with 'The'
img[alt~="The" ]{
margin-right: 55px;
margin-bottom: 15px;
}
//Matches all images whose ALT attribute have the word 'TV' in them
img[alt*="TV" ]{
margin-bottom: 15px;
}
}
//Matches the first list element
ul li:first-child { //css2
color: red;
text-decoration: underline;
}
//Matches the last list element
ul li:last-child { //css2
color: blue;
}
//Matches every third list element
ul li:nth-child(3n) { //css3!
color: green;
}
And More...
-moz-column-width: 13em; -webkit-column-width: 13em; -moz-column-gap: 1em; -webkit-column-gap: 1em;
width: -moz-calc(25% - 1em);
Filters for IE
SVG background images. Multiple background images.
RGBA rgba(255,255,255,0.7); HSLA Colors hsla(0,0%,100%,0.7);
and the Presentation part...
CSS 3 is not for going back to 1990 :)
Use fonts carefully - embed fonts in CSS files
Opacity may lead to performance hits
Excessive transforms cost rendering cycles
Vendor Prefixes
Guard the modularity