webmonkey

 

overview of shortcut properties

Page history last edited by Robert Christensen 2 yrs ago

Shortcuts

In CSS, there are many ways to code the same style. The typical way is clear and comprehensive, but can be time consuming. There is a much easier, shorthand way of writing certain aspects of CSS. This page will show you how to condense some of your code.

 

Normally, for font styling you would have a selector with many attributes on separate lines, like so:

 

font-weight: bold;

font-family: arial;

font-size: 12px;

line-height: 18px;

 

That alone is four lines a code, and if you have a separate styling for different classes or selectors, it can add up and make your style sheet grow exponentially. These four lines can be condensed into a single attribute quite easily:

 

font: bold 12px/18px arial;

 

See? Both examples contain code that performs exactly the same, but one takes four times as long to write!

Comments (0)

You don't have permission to comment on this page.