Re: [CSS-idea] CSS with classes.

And what about something so:

    selector1 {
        @rule('selector2') { // same as selector1 selector2
            property: value;
            property: value;
            property: value;
            ...
        };
        property: value;
        property: value;
        property: value;
        ...
    }

It's a real time-saver and it we have all the code in a logical cascading style.

Eg: 
    div.menu, div.contextMenu {
        @rule('> a') {
            display: block; cursor: pointer;
        };
        @rule('> a:hover') {
            background: highlight;
            color: highlighttext;
        }
        background: buttonface;
        color: black; font: menu;
    }

In remplacement of :
    div.menu, div.contextMenu {
        background: buttonface;
        color: black; font: menu;
    }
    
    div.menu > a, div.contextMenu > a {
        display: block; cursor: pointer;
    }
    
    div.menu > a:hover, div.contextMenu > a:hover {
        background: highlight;
        color: highlighttext;
    }

In addition, if we add this to @define styleSet / @style-set, we can have the same behaviour as requested.

    @define menu-style-set {
        @rule('...') {}
        @rule('...') {}
        ...
    }
    
    div.menu, div.contextMenu { extends: menu-style-set; }

Fremy
  From: Tab Atkins Jr. 
  Sent: Wednesday, July 02, 2008 4:02 PM
  To: Daniel Glazman 
  Cc: Andrew Fedoniouk ; www-style 
  Subject: Re: [CSS-idea] CSS with classes.





  On Wed, Jul 2, 2008 at 1:47 AM, Daniel Glazman <daniel.glazman@disruptive-innovations.com> wrote:


    Andrew Fedoniouk wrote:


      Here is the idea for how to extend CSS by classes or style sets. So to get CSS++ - object oriented CSS.



    I think this proposal gives CSS two things : power and total
    unreadability. I'm not ready to accept the latter to get the former.

    If we go that way, soon only the original author of a given stylesheet
    will be able to modify it because of the complexity of the prose...

    I'm against this proposal.

    </Daniel>


  Agreed in opposition.  I think the proposal is very interesting in its use of the :root pseudo-class, but allowing a styleset to descend arbitrarily down the markup means that putting a styleset rule into one block can have difficult-to-predict results on later selector blocks, unless you've completely internalized all the 'classes' you're working with.  The standard variable proposals limit the effect of a variable to only the block it shows up in (plus inheritance, of course, but that's standard).

  ~TJ

Received on Wednesday, 2 July 2008 14:38:15 UTC