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 6180619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:52:34+00:00 2026-05-24T00:52:34+00:00

I have a div which has some stuff in it, and the user has

  • 0

I have a div which has some stuff in it, and the user has the option of clicking an ‘x’ to say “This is not applicable to me”, for example.

Rather than delete the div, I want to play a translucent div on top of it.

I started off with some complicated javascript to determine the size and location of my div in question, and create a new one on top of it. The script was giving a size and location which looked approximately right to my eye, but the overlap div was being put in the wrong spot.

Then I realised that there is (probably) a much simpler way to do this.

I put a div with class “blackout” inside the div I want to black out. The blackout css class has a visibility set to hidden, so javascript will set that to visible when needed.

The issue I’m having is that even with this method, I can’t seem to get it to precisely fill the rectangle the parent div has.

I had

.blackout
{
  position: absolute;

  left: 0px;
  right: 0px;
  top: 0px;
  bottom: 0px;

  background-color: black;

  opacity: 0.5;
  filter: alpha(opacity = 50);
}

This filled up the whole screen rather than just the parent div.

What do I need to change to make it fill the parent div only?

  • 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-24T00:52:35+00:00Added an answer on May 24, 2026 at 12:52 am

    This filled up the whole screen rather than just the parent div.

    What do I need to change to make it fill the parent div only?

    You need to add position: relative to the parent div.

    That will set the parent div as the “containing block” for .blackout:

    If the value of the position property is absolute, the containing
    block is the nearest positioned ancestor—in other words, the nearest
    ancestor whose position property has one of the values absolute,
    fixed, or relative.

    Read more here: http://reference.sitepoint.com/css/containingblock

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

Sidebar

Related Questions

I have some set of div which has a class name. Here I want
I have a div tag which has some background color, that adds good look
I have small page which has label, DropDownList and a submit button. <div> <asp:label
I have one aspx page with some controls. Also i have one DIV which
I have a div (sub area of page with scroll bar) that has some
I'm using asp mvc 2 and I have a page which has some data
I have a div which currently has a static background image. I need to
I would like to add a content before some div which has several sections
If I have a container div called #container which has a bunch of .inside
I have an image slideshow, which has a small DIV on top of it

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.