Forums

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

Home Forums CSS LESS: Background color inheritance

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

    Hey everyone.

    I’ll cut to the chase.. I’m using LESS for the first time and trying to figure out something which seems pretty straight forward, but is proving not to be.

    I have a 8 sections, each with their own unique background color. Inside each section is a link. I want this link to inherit the background color of its parent section. I then want to saturate it by 20%. Something like this:


    section a{
    background: saturate(@parent-bg-color, 20%);
    }

    Can I do this without having to specify background colors for each one? I’d like to avoid this:


    section#one a{
    background: saturate(@section1-color, 20%);
    }
    section#two a{
    background: saturate(@section2-color, 20%);
    }
    section#three a{
    background: saturate(@section3-color, 20%);
    }
    etc.. etc..

    #88896
    TheDoc
    Member

    Hmmmm… pretty sure you’d have to specify each one.

    #88904
    Johnnyb
    Member

    Hey Doc, cheers for the reply. I guess I was hoping there was some secret LESS magic which would let me do that without having to specify, but I think I was just getting greedy! I suppose I’ll have to resort to the “old school CSS” way of doing things!!

    #88906
    TheDoc
    Member

    Well, to be fair, I don’t really know too much about LESS – so maybe there is something in there that I’m unaware of.

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