Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Dynamic css

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #29797
    EhhWhat
    Member

    Hi All

    I remember seeing a post somehwere on the interweb a few months back about an interesting way of writing CSS, problem is i cant remember the article or find it again.

    The jist of the method was that you could set values to colours for example so you could change the red you use throughout a website in one place rather than having to change it in loads, example below

    red {#ff0000}

    #header p {
    color: red;
    }

    #footer p {
    color: red;
    }

    So you could just change the color used at the top to change both p tags below.

    Does anyone remember this as well or have a link to the article?

    #80752
    limenet
    Participant

    I think, you mean somethin like LESS (which works with JS)? For a great tutorial, head over to nettuts! There are also some tools built with php – just google for them (I can’t remember one at the moment – sorry). But – as always – you could also build your own solution… (with php)

    Code:
    <?php
    header(‘Content-Tpye:text/css’); //output css
    $red = "#f00"
    ?>
    #header p, #footer p{
    color: <?=$red?>
    }

    Hope this helps,
    Linus

    #80753
    EhhWhat
    Member
    "limenet" wrote:
    I think, you mean somethin like LESS (which works with JS)? For a great tutorial, head over to nettuts! There are also some tools built with php – just google for them (I can’t remember one at the moment – sorry). But – as always – you could also build your own solution… (with php)

    Code:
    <?php
    header(‘Content-Tpye:text/css’); //output css
    $red = "#f00"
    ?>
    #header p, #footer p{
    color: <?=$red?>
    }

    Hope this helps,
    Linus

    Sure did, thats exactly the thing i was looking for :D

    Cheers.

    #80986
    limenet
    Participant

    oh… in case you want more comfort (automatic rewriting of url’s and caching …) nettuts has a very nice solution :)

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.