SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to use a class as a property value?

    I'd like to be able to include classes as property values:

    .mycolor {color: #cccc99}
    h1 { color: mycolor}
    h2 { color: mycolor}

    So that I can change the color once and have it affect all occurances in
    the style sheet.

    Is something like this possible?

    Thanks!

  2. #2
    SitePoint Addict
    Join Date
    Jul 2001
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not possible that I am aware of, but someone may come along to prove me wrong.

    You would have to get into some javascripting to write in the correct variables and such.

  3. #3
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How bout defining all the colors in one declaration:

    h1,h2,td,ol etc... {color:#cccc99}

  4. #4
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by isotope235
    How bout defining all the colors in one declaration:

    h1,h2,td,ol etc... {color:#cccc99}
    That may be the best option and it'll save a bit of space, too. But in a massive overhaul of the stylesheet, it may make it more difficult to sort through (especially if it's the slightest bit long). :-)

    ~~Hope This Helps

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could make your .css file be .css.php and parse it as a php file like this:
    PHP Code:
    <?php
    $color 
    '#ff9900';
    ?>
    h1 { color: <?= $color ?>; }
    h2 { color: <?= $color ?>; text-decoration: underline }
    etc.
    ck :: bringing chris to the masses.

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From a strictly organizational standpoint, it would be best to define your syles in groups instead of duplicating lines.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


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
  •