• Resolved hagal1998

    (@hagal1998)


    Hi there,

    Following CSS was added:

    .site-main {
        background: #fff;
        opacity: 0.8;
    }

    This brings opacity in my content-body.
    But I dont want opacity for pictures or videoclips.

    is this possible?

    best regards.

    is it possible

Viewing 6 replies - 1 through 6 (of 6 total)
  • CSS opacity sets transparency to the element it is applied on and all contents inside it. To apply transparency to the container without affecting the content inside, like text, images etc, use this:

    .myelement {
        background: rgba(200, 54, 54, 0.5);
    }

    where the last parameter 0.5 is the transparency value (50%).

    Let me know if this helps.

    Thread Starter hagal1998

    (@hagal1998)

    G’day mate,

    it doesn’t work, sadly.

    Here https://www.aussieblogger.de/ you can see my site.

    If I insert your code and disable my code the whole content doesn’t have any opacity

    kind regards.

    Moderator Kathryn Presner

    (@zoonini)

    @hagal1998

    The code @subrataemfluence provided (thanks for the help!) was just an example – you’d need to change it to reference your own element and colours. Give this a try and let me know how it goes:

    .site-main {
      background: rgba(255, 255, 255, 0.8);
    }

    Thank you @zoonini for clearing up. I should have mentioned it in my reply.

    Thread Starter hagal1998

    (@hagal1998)

    G’day mates,

    that’s it ??

    THX. so much.

    best regards

    Moderator Kathryn Presner

    (@zoonini)

    Glad you’re set! I’ll mark this as resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Opacity only for text-body’ is closed to new replies.