Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3354226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:14:48+00:00 2026-05-18T02:14:48+00:00

I want apply opacity for parent but I do not want the child element

  • 0

I want apply opacity for parent but I do not want the child element to inherit this opacity.

<div class="parent">
 <div class="child"></div>
</div>

.parent {
  opacity: 0.6;
}

Is there a way to “cancel” the inherited opacity? maybe force it to opacity=1for the child element?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:14:49+00:00Added an answer on May 18, 2026 at 2:14 am

    The opacity of the child will always be the opacity of the parent if the opacity of the child is 1.

    This is not a problem with inheritance, but rather with the way opacity is calculated.

    For instance,

    <div id="parent">
        <div></div>
    </div>
    
    <div id="original">
    </div>
    
    <div id="quarter">
    </div>
    
    #parent div, #quarter {
        width: 100px;
        height: 100px;
        background-color: orange;
    }
    
    #parent div {
        opacity: 0.5;
    }
    
    #parent {
        opacity: 0.5;
    }
    
    #quarter {
        opacity: 0.25;
    }
    

    #quarter‘s opacity, from your perspective, is the same as that of #parent div, but in actual fact, #parent div has twice the opacity of #quarter. See this jsfiddle for more detail: http://jsfiddle.net/HUaNm/


    The only way to avoid this is to move the child out of the parent. Alternatively, depending on what you want here, you can also use rgba colors for the background/border/font color of the parent instead of opacity, but the effect is not the same as applying opacity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this elements <div class="a b"></div> <div class="b"></div> <div class="a"></div> I want apply
I want apply margin property for my html newsletter But Gmail ignores this CSS
I want to apply cycle to the div block with dynamic content. This content
I want to apply the rules in a CSS file to a certain div/class
How can i only impact the opacity of a parent element and not its
i want to apply the CSS only first li but :first-child apply to all
I want to apply my custom CSS on HTML page i tried this way
I want to apply texture to the transparent png(bitmap), but I don't want to
I want to apply a Storyboard to my Rectangle Fill like this: <Rectangle Name=MyRectangle
I want to be able to apply opacity to some elements to make them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.