HighDots Forums  

simple q. re order of values..

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss simple q. re order of values.. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
maya
 
Posts: n/a

Default simple q. re order of values.. - 10-20-2007 , 11:56 PM






hi,

when only three values are specified, like for example

margin:10px 0 0;

which ones are they, please.. (this makes it so much more confusing; why
would anybody do this? (actually, I think this might from code that was
generated w/a tool.. do tools generate code like this??))

thank you..


Reply With Quote
  #2  
Old   
rf
 
Posts: n/a

Default Re: simple q. re order of values.. - 10-21-2007 , 12:24 AM







"maya" <maya778899 (AT) yahoo (DOT) com> wrote

Quote:
hi,

when only three values are specified, like for example

margin:10px 0 0;

which ones are they, please..
Why not go directly to the specifications.
http://www.w3.org/TR/CSS21/box.html#propdef-margin
There is a paragraph dealing with exactly this.

You would find out quicker than the time it took you to ask this question.

BTW the answer is not what you might think it would be.

--
Richard.




Reply With Quote
  #3  
Old   
dorayme
 
Posts: n/a

Default Re: simple q. re order of values.. - 10-21-2007 , 12:36 AM



In article <ffem6n$q1l$1 (AT) aioe (DOT) org>, maya <maya778899 (AT) yahoo (DOT) com>
wrote:

Quote:
hi,

when only three values are specified, like for example

margin:10px 0 0;

which ones are they, please..
What you have here is equivalent to

margin-top: 10px;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;

For those who simply will not accept that there are different
sorts of nothing, it is very hard to see what quite is going on
in your example. Which nothing, for example, is informing the
right, bottom and left, given that you have two nothings that yet
generate three values of nothing?

Perhaps this will appeal to the more down to earth types rather
than the explanation I favour but which would get me shot:

body {margin: 1px;} is equivalent to

margin-top: 1px;
margin-right: 1px;
margin-bottom: 1px;
margin-left: 1px;

body {margin: 1px 2px;} is equivalent to

margin-top: 1px;
margin-right: 2px;
margin-bottom: 1px;
margin-left: 2px;


body {margin: 1px 2px 3px} is equivalent to

margin-top: 1px;
margin-right: 2px;
margin-bottom: 3px;
margin-left: 2px;


body {margin: 1px 2px 3px 4px;} is equivalent to

margin-top: 1px;
margin-right: 2px;
margin-bottom: 3px;
margin-left: 4px;

It is an exceedingly stupid thing to do to put in three values
because no one can remember these things and it smacks of
pretentious posing. 4 is ok if they are different, 2 is a genuine
shortcut, one is obviously so. But 3 is in a class of its own, it
is a particularly provocative and irritating thing and I
recommend, with my considerable authority, against it. In fact,
just seeing it has made me feel iller than I already feel.

--
dorayme


Reply With Quote
  #4  
Old   
Stan Brown
 
Posts: n/a

Default Re: simple q. re order of values.. - 10-21-2007 , 08:25 AM



Sun, 21 Oct 2007 00:56:53 -0400 from maya <maya778899 (AT) yahoo (DOT) com>:

Quote:
when only three values are specified, like for example

margin:10px 0 0;

which ones are they, please.. (this makes it so much more confusing; why
would anybody do this?
You might want to fix the Shift key on your keyboard.

They are in clockwise order:
top (12), right (3), bottom (6), left (9).

If there are only 3, left=right. If there are only two, left=right
and bottom=top. If there is only one, left=bottom=right=top.

Note that putting margins in pixels is generally a bad idea.

As to why anyone would specify only three, it makes a lot of sense if
they want left and right to be equal -- (slightly) shorter CSS file,
and less to maintain.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.