Skip to main content

CSS3 My Favorite Tricks

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.

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

Popular posts from this blog

Simple client side validation library

  Client side validation has never been easy.. Include jQuery and the validator.js < script src = " http://code.jquery.com/jquery-1.11.3.min.js " ></ script > < script src = " ../validate.js " ></ script > Simple validation < form id = " myForm " > < label >User Name < span class = " red-star " >*</ span > </ label > < input type = " text " name = " userName " class = " validate-required " /> < br /> < label >Password < span class = " red-star " >*</ span ></ label > < input type = " password " name = " password " class = " validate-required " /> < br /> < input type = " submit " value = " Login " /> </ form > ...

Overriding default look and feel of GREG - 5.3.0

Following list explains what are the best approach for different use cases. 1 ) - You created a new asset type, and you need to change the look and feel of the details page in the listing page just for that new asset type. To create a new asset type you need to login to the carbon console (username:admin, password:admin) https:// :9443/carbon/ Navigate to Extensions > Configure > Artifacts Click "Add new Artifact" link at the bottom of the page. By default in the "Generic Artifact" area "application" asset type is loaded. Note the shortName="applications" in the root node. "applications" is the name of the asset type. Browse in to /repository/deployment/server/jaggeryapps/store/extensions/assets Create a folder with name "applications"    Now we can override the files in /repository/deployment/server/jaggeryapps/store/extensions/app/greg-store-defaults   Since we are overriding the details page we need to...

Role of GREG permission-mappings.xml

 GREG has a permission-mapping.xml. We can find it at /home/chanaka/Desktop/greg/wso2greg-5.2.0/repository/conf/etc/permission-mappings.xml Each entry has three attributes. managementPermission resourcePermission resourcePaths  Ex: managementPermission="/permission/admin/manage/resources/govern/server/list" resourcePermission="http://www.wso2.org/projects/registry/actions/get" resourcePaths="/_system/governance/trunk/servers" /> There are default configurations in this file. These entries are mapping each permission in the permission tree in to resource paths and assign them permissions. With the above line in the permission-mappings.xml, an admin user who assign the permission " /permission/admin/manage/resources/govern/server/list " will be able to do get operations on registry resources stored at " /_system/governance/trunk/servers ". We can provide multiple resource paths by separating them by comas. There...