SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)

    A random thought on square braces [] this morning.

    I don't think square braces are used anywhere in the css spec. A thought occurred to me this morning - why not use them for subproperties - like this

    Code css:
    body {
      font [
        face: Arial;
        size: 2em;
        style: italic;
        weight: bold;
      ]
    }

    Yeah, we have property shorthands, but for some modules this is getting out of hand. In particular backgrounds. When a property can have multiples they can be comma separated...

    Code css:
    body {
      background: [
        image: url(some/path);
        opacity: .2;
        color: #fff;
        position: fixed;
        size: 50;
      ], [
        image: url(some/path);
        opacity: .2;
        color: #fff;
        position: fixed;
        size: 50;
      ]
    }

    The idea further is that these could be nestable as seen here with border, where the top property has a more specific call than the other three.

    Code css:
    div {
      border [
        width: 1em;
        style: solid;
        top [
          width: 2em;
        ]
      ]

    Just a thought. Now someone can come in and tell me why this is utterly stupid and unworkable
    BTW, this isn't a replacement for multi-property shorthand (for example: border: 1px solid #ff0). It's a more approachable, legible alternative (as it doesn't require the reader to have memorized the argument order).

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Attribute selectors is usually where you'll find them used: http://www.w3.org/TR/CSS2/selector.h...bute-selectors

  3. #3
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)
    Ah, forgot those. Still, contextually, that isn't within the property lists though, so it still could work.

    Code css:
    input[type=text] {
      background [
        color: #fff;
        size: 1em;
      ]
    }

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    It would screw up all of us using Python, Javascript, JSON etc.

    {} denotes objects and name-value pairs to us. So using array-like symbols would be weird.

    Maybe background=[{'color': '#fff'}, {'size': '1em'}, {'etc': 'etc'}]; but then it starts getting way too verbose.

    Since all those fancy CSS preprocessors make all sorts of syntax changes (some, like clevercss, seem to change syntax just for the hell of it), might as well use one of those or home-brewed and let browsers stick with what they already know.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •