Forums

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

Home Forums CSS Different colors for different subfolders

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #271252
    caligo
    Participant

    Hi all,

    What I want to achieve is following:

    domain.com/folder1/…

    domain.com/folder2/…

    For every URL in folder1 I want to use a specific color set (headline, linkcolor, color sidebar)

    For every URL in folder2 I want to use another color set (headline, linkcolor, color sidebar)

    What is the best way to do this without javascript?

    With my knowledge I think that using different IDs could solve the problem

    div#folder1 h1 h2 h3 a …. {…}

    div#folder2 h1 h2 h3 a …. {…}

    How would you do it?

    Thanks in advance!

    Tobi

    #271253
    Paulie_D
    Member

    Folders are not HTML elements…the are part of the path to the page which has the HTML body element or whatever,

    If each page inside the folder has a class on, say, the body reflecting the folder number then what you are suggesting is possible….but it’s a lot of work to maintain.

    #271257
    caligo
    Participant

    Sry, my fault.

    I meant that I put everything that is in “folder1” in a <div> with id=”folder1″ and so on.

    Would this work?

    #271259
    Paulie_D
    Member

    Sure, you could, but it’s probably easier to use the body element as the identifier since everything will be a child of the body.

    I prefer classes to IDs but that’s up to you.

    #271260
    Paulie_D
    Member

    Frankly, I think you might find CSS Custom Properties very useful here.

    https://www.smashingmagazine.com/2018/05/css-custom-properties-strategy-guide/

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