Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Padding question 3

Status
Not open for further replies.

danima

Programmer
Jan 9, 2002
134
CA
Quick question...

I'm sure I've seen this somewhere before but can't remember the proper code. Instead of using

style="padding-left: 15px; padding-top: 15px;"

isn't there a shorter version that goes something like this?

style="15px, 0px, 15px, 0px"

Thanks

 
Thanks muchly...very timely.

I love this forum!
 
Actually, there are several shortcut ways of specifying padding (though not, admittedly, to do it for just top and left sides):
Code:
padding: 1px; /* Applies 1px padding to all sides */

padding: 1px 2px; /* 1px top & bottom, 2px left & right */

padding: 1px 2px 3px; /* 1px top, 2px left & right, 3px bottom */

padding: 1px 2px 3px 4px; /* 1px top, 2px right, 3px bottom, 4px left */
The way to remember the last one is that it's like a clock face, applying properties clockwise starting from 12 o'clock.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Another way to remember it is the the acronym TRBL (pronounced "trouble"). That's the technique I usually use.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Perfect...that's how I remember things!!

Cheers,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top