Ten CSS tricks you may not know

That’s Webcredible! No, it really is. Today I wanted to show you a resource with some helpful CSS tricks that you may not be aware of. Check it out:

1. CSS font shorthand rule

When styling fonts with CSS you may be doing this:

font-weight: bold;
font-style: italic;
font-varient: small-caps;
font-size: 1em;
line-height: 1.5em;
font-family: verdana,sans-serif

There’s no need though as you can use this CSS shorthand property:
font: bold italic small-caps 1em/1.5em verdana,sans-serif

Much better! Just a couple of words of warning: This CSS shorthand version will only work if you’re specifying both the font-size and the font-family. Also, if you don’t specify the font-weight, font-style, or font-varient then these values will automatically default to a value of normal, so do bear this in mind too. [Read the rest]

Article Written by