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

  • SEARCH
  • Home
  • 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 8888521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:04:05+00:00 2026-06-14T22:04:05+00:00

How can I make a specific div with transparent background-color over a div with

  • 0

How can I make a specific div with transparent background-color over a div with black background-color?

Thanks.

I have tried to make it work with adding another div with transparent but no luck, my code as below

.a {
    width: 300px;
    height: 300px;
    position: absolute;
    top: 0;
    left: 0;
}

.b {
    opacity: 0.7;
    background-color: #000;
    width: 300px;
    height: 300px;
    position: absolute;
    top: 0;
    left: 0;
}

.c {
    opacity: 1;
    position: absolute;
    top: 120px;
    left: 170px;
    width: 100px;
    height: 30px;
    background-color: transparent;
}​

<div class="a"><img src="http://www.helpinghomelesscats.com/images/cat1.jpg" /></div>
<div class="b"></div>
<div class="c"></div>

http://jsfiddle.net/sJW6U/1/

BEFORE
enter image description here

AFTER
enter image description here

  • 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-06-14T22:04:07+00:00Added an answer on June 14, 2026 at 10:04 pm

    The problem here is even if you do this you’re just going to see your semi-black div behind your transparent one, it’s not going to “cut out” the div below it.

    What about this?

    .a {
        width: 300px;
        height: 300px;
        position: absolute;
        cursor: none;
        top: 0;
        left: 0;
        /*overflow hidden to contain box shadow*/
        overflow: hidden;
    }
    
    .b {
        position: absolute;
        /*using box-shadow to create background*/
        -webkit-box-shadow: 0 0 0 50000px rgba(0,0,0,0.7);
        box-shadow: 0 0 0 50000px rgba(0,0,0,0.7);
        /*change height and position as needed*/
        width: 50px;
        height: 50px;
        top: 45px;
        left: 75px;
        z-index: 10;
    }​
    

    Markup will have to change to the following:

     <div class="a">
        <img src="http://www.helpinghomelesscats.com/images/cat1.jpg" />
        <div class="b"></div>
    </div>
    

    http://jsfiddle.net/sJW6U/71/

    Hope this helps.

    Bonus: use something like this to attach .b to the mouse:

    $(document).on('mousemove', function(e){
        $('.b').css({
           left:  e.pageX -25,
           top:   e.pageY -25
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can you redefine a class if its in another specific class? div.cls {
I have looked all over for a solution but can't find anything specific and
How can make a link within a facebox window that redirects it to another
Can someone tell me how I can make the following output? I have a
i have doubt about how can i iterate into a group of div, my
Outline I'm building a form for a specific page, where users can make suggestions
I have couple <a> within a parent div which will perform a specific action
I have jquery menu that on click shows specific div element. I wonder if
I have a div with absolute position on a page which overlaps on another
I have the following jquery code which loads the #content div from another page,

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.