CSS3 is cool. It's animation and 3D stuff are amazing. But things like rounded corner and gradients are the most useful. I am listing down few tricks that I use often for my own quick reference.
No more slicing.. and repeating images to make shaded backgrounds.
I like to give a div a transparent background and put some kind of a background image under it. Drop the shadow from that box make it look much nice..
Interesting thing to note here is the table.tableStyle tr:nth-child(even) selector. This is to color two rows with different colors, which we had to write javascript earlier.
Gradient
No more slicing.. and repeating images to make shaded backgrounds.
background-image: -webkit-gradient(linear, left top, left bottom, from(#6f6f6f), to(#000000)); /* mozilla - FF3.6+ */
background-image: -moz-linear-gradient(top, #6f6f6f 0%, #000000 100%); /* IE 5.5 - 7 */
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#6f6f6f',EndColorStr='#000000'); /* IE8 */
-ms-filter: progid: DXImageTransform . Microsoft . gradient(gradientType = 0, startColor = '#CCCCCC', endColoStr = '#000000'); /*Transparent back */
Shadows. Rounded Corner, and Transparent Layers.
I like to give a div a transparent background and put some kind of a background image under it. Drop the shadow from that box make it look much nice..
/*Transparent back */
opacity:0.4;
/*Rounded corners */
-moz-border-radius: 3px;
border-radius: 3px;
border: solid 1px #888888;
/*The shadow */
-moz-box-shadow: 3px 3px 2px #ddd;
-webkit-box-shadow: 3px 3px 2px #ddd;
box-shadow: 3px 3px 2px #ddd;
Styling a table with CSS3
Interesting thing to note here is the table.tableStyle tr:nth-child(even) selector. This is to color two rows with different colors, which we had to write javascript earlier.
table, td, div, span, a {
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
font-size: 12px;
}
table.tableStyle {
border-left: solid 1px #468aa6;
border-top: solid 1px #468aa6;
border-collapse: collapse;
}
table.tableStyle th {
background-image: -webkit-gradient(linear, left top, left bottom, from(#56aed2), to(#417f98));
background-image: -moz-linear-gradient(top, #56aed2 0%, #417f98 100%);
filter: progid:DXImageTransform.Microsoft.gradient(gradientType = 0, startColor = 0, endColorStr = #417f98);
-ms-filter: progid:DXImageTransform.Microsoft.gradient(gradientType = 0, startColor = 0, endColoStr = #417f98);
color: #fff;
font-size: 11px;
text-align: left;
padding: 3px;
border-right: solid 1px #468aa6;
border-bottom: solid 1px #468aa6;
}
table.tableStyle td {
border-right: solid 1px #468aa6;
border-bottom: solid 1px #468aa6;
margin: 0px;
padding: 3px;
}
table.tableStyle tr:nth-child(even) {background: #ccdde1}
table.tableStyle tr:nth-child(odd) {background: #FFF}
Comments