Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2006, 04:51 PM
Authorized User
 
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using shorthand

I have trouble remembering what the values in shorthand correspond to, e.g., in:

margin: a, b, c, d;

... which of a, b, c and d correspond to top, leftside, etc.

Is this something you just remember with practice, or do you have a mnemonic to help you remember? Also, is the shorthand in the same order for padding?

It's an example of something that you think "this will take too seconds to look up in my reference books", but actually end up taking ten minutes, so to date I've found it quicker to use the longhand!

Cheers,

Carl

 
Old January 21st, 2006, 05:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Quote:
quote:Originally posted by ceadge
 I have trouble remembering what the values in shorthand correspond to, e.g., in:

margin: a, b, c, d;

... which of a, b, c and d correspond to top, leftside, etc.

Is this something you just remember with practice, or do you have a mnemonic to help you remember? Also, is the shorthand in the same order for padding?
Yes, it's the same for padding. I use to think of a clock, starting at 12:00 (00:00), the order going clockwise. Top - right - bottom - left. You just have to remember to start at 00:00 and then follow the hand.

Quote:
quote:
It's an example of something that you think "this will take too seconds to look up in my reference books", but actually end up taking ten minutes, so to date I've found it quicker to use the longhand!
Come on, now! :)
Then you need to go there more often. Starting either here:
http://www.w3.org/TR/REC-CSS2/propidx.html
here:
http://www.w3.org/TR/REC-CSS2/cover.html#toc
or here:
http://www.w3.org/TR/REC-CSS2/indexlist.html
will take you here:
http://www.w3.org/TR/REC-CSS2/box.html#propdef-margin
and here:
http://www.w3.org/TR/REC-CSS2/box.html#propdef-padding
in a couple of seconds. But if you find it hard, why not bookmark the bits or note the rules down?



--
http://yupapa.com
 
Old January 22nd, 2006, 12:24 AM
Authorized User
 
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brilliant, that's exactly what I needed - don't think even I could forget a clock starting at 12!

Cheers,

Carl

 
Old January 22nd, 2006, 12:34 AM
Authorized User
 
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

And I have taken you up on the suggestion of bookmarking your excellent links. Thanks meow!

 
Old January 23rd, 2006, 11:55 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Just FYI for anyone else that reads this, it is always...

Four values: top, right, bottom, left (e.g. margin: 2px 2px 2px 2px)

Three values: top, right and left, bottom (e.g. margin: 2px 2px 2px)

Two values: top and bottom, right and left (e.g. margin: 2px 2px)

One value: all four sides. (e.g. margin: 2px)

This applies to all applicable properties, margin, padding, border-color, border-width, border-style, etc.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old February 10th, 2006, 11:57 AM
Authorized User
 
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was experimenting with a document today, and was using the following style rule:

margin:5px 10%;

i.e. note the mixture of measurement units.

It's for the main "wrapper" div, containing and boxing up all the document content, and seems to work OK in the browsers I have. But is it legitimate as far as the W3C are concerned, and do any browsers have trouble with it?

 
Old February 11th, 2006, 01:14 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Easiest answer is: Try it in other browsers and see if it works.

Or if you have lots of free time, you could read the w3c spec on CSS.

-Peter









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.