[css-d] CSS aesthetic structure

2009-08-20 Thread Tommy Ahlbäck
Hi all,

I have some thoughts regarding the aesthetic structure of CSS that I  
would like to share. It's just something that came to my mind at work  
today, nothing more, nothing less..

When using descendant selectors many of us write our code like below.

#nav-main {
property: value
}

#nav-main ul {
property: value
}

#nav-main ul li {
property: value
}

#nav-main ul li a {
property: value
}

I have no problem with that, but it would be much easier to see the  
hierarchy if it would be possible to write nested code more like a js,  
as, php etc function. That way we wouldn't have to repeat #nav-main  
before the nested selectors all the time. Look at the example below. I  
mean, it's quite obvious that ul and li is descendant from #nav-main.

Like I said before, this was just something that came to my mind. I  
haven't gave this much thought. There's probably tons of disadvantages  
that I haven't think of. I just can't let go of the beauty in the  
visual structure. Well, that is my opinion ofcourse. :) First thing  
would be to make the rendering engine to understand that there can be  
a selector in the same area as the property.

So, what do you think?

#nav-main {
property: value;

ul {
property: value;

li {
property: value;

a {
property: value;
}
}
}
}




**
With Best Regards,

Tommy Ahlbäck

__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] CSS aesthetic structure

2009-08-20 Thread Alan Gresley
Tommy Ahlbäck wrote:
[...]
 So, what do you think?
 
 #nav-main {
   property: value;
   
   ul {
   property: value;
 
   li {
   property: value;
   
   a {
   property: value;
   }
   }
   }
 }
 With Best Regards,
 
 Tommy Ahlbäck



Hello Tommy,

I think that is quite good idea but it doesn't belong on CSS discuss but 
rather the CSS WG list. BTW, this was a huge topic there over a year ago.


http://lists.w3.org/Archives/Public/www-style/2008Feb/0133.html


It's called a CSS constant. Noticing that the topic has dried up, maybe 
we will have to wait and hope.


-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/