Dim the entirety of the page while accentuating specific regions

Check out this demo on JSFiddle

I'm trying to figure out how to bring the .highlight element to the front.

<body>
    <p>bla bla</p>
    <p class="light">highligh this</p>
</body>

CSS

body{
    background-color: rgb(0, 0, 0);
    opacity: 0.35; /* Safari, Opera */
    -moz-opacity:0.70; /* FireFox */
    filter: alpha(opacity=70); /* IE */
    z-index: 20;
    height: 100%;
    width: 100%;
    top: 0px;
    left: 0px;
}

p{
    color: #fff;
}

Answer №1

One option is to create an overlay element with a popup on top:

.overlay{
  width:100%;
  height:100%;
  position:absolute;
  top:0;
  left:0;
  background-color:rgba(0,0,0,0.7);
  z-index:1000;
}
.popup{
  width:400px;
  height:300px;
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
  background-color:#f9f9f9;
  z-index:1100;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with Touch Event functionality in FullCalendar version 3.9?

I am currently using the FullCalendar 3.9 version plugin to display Driver events. The issue I'm facing is that the click event works fine on desktop view, but not on mobile devices since touch events are used there. How can I bind a touch event on th ...

PHP script redirects to its own URL successfully, but the functionality fails when triggered by CRON

I am facing an issue with a program that calls itself iteratively. redirect($_SERVER["PHP_SELF"]); function redirect($url,$seconds=0) { $html="<html><head><meta http-equiv='refresh' content='$seconds; URL=$url'>< ...

Determine which checkboxes are checked using jQuery

Is there a way to identify which checkboxes are checked after clicking on a specific button in a scenario where I have multiple checkBoxes created under a single div with data-role="controlgroup"? I am using JQuery for this task and need the best approac ...

Retrieving information from a table row and using it as a parameter in the URL for an AJAX request

New to implementing ajax, JQuery, and Json in my strut2 web application. I have a table on one web page with records displayed, and the last column contains an image as shown below. Currently using an anchor tag with an image for the last column with an ac ...

Checking the correctness of a username through the use of AJAX, JSON, and ASP

Recently, I have started learning about json, ajax, jquery, and web services. I am currently working on a registration page where users can check the availability of a username instantly by typing in a few letters. My setup includes an HTML file for the ...

How can I convert JSON into an object using JQuery?

const photoGallery = new PhotoGallery([[{"photo":{"updated_at":"2021-10-15T10:30:00Z","title":"Amazing Sunset","views":350,"uploaded_by_profile_id":5,"comment_count":12,"id":123,"description":"Beautiful sunset landscape","category":"nature","created_at":"2 ...

Whole page scrolling instead of just inner div scrolling

Once again, I find myself tinkering with CSS... In the current setup, the map container is scrolling on its own, separate from the rest of the content within the container. How can I enable the entire page to scroll when additional content is added to the ...

Toggle the jQuery class off when a different element is chosen

I've created a function that toggles a class to change the style of an element when it is selected. However, I'm facing an issue where the new style remains even when another element is selected. Is there a way to make the styling revert back to ...

Guide to updating text color in marquee tag with each reload

Seeking assistance in addressing the following issues... On each refresh, I want to change the text color within a marquee tag by utilizing a JavaScript function. I have obtained a color code like #18EEC5... however, when attempting to call the script fun ...

"Which is better for handling form data: using $.ajax with hidden fields or PHP form

Creating a streamlined admin tool using PHP and JQuery to handle image data management is my current project. The main goal of this utility is to enable an admin to retrieve images from a database, view associated tags for each image, and add new tags as n ...

At times, the jQuery function may fail to execute

Here is a function I have been using to set an iframe height to match its content: $("#MSOPageViewerWebPart_WebPartWPQ1").load(function() { var Height = document.getElementById('MSOPageViewerWebPart_WebPartWPQ1').contentWindo ...

Problem with jQuery offset: SWF position remains unaffected

I attempted to create a code that would position an SWF file on top of an HTML button using jQuery's offset function to determine the coordinates. However, despite my efforts, the SWF does not appear to move as intended. var offset = $("#button").off ...

empty area located on the right side of my HTML/CSS website

I'm struggling to figure out why a small white space appears next to my webpage. Inspecting the element shows that the body ends before the space begins, indicating the border is where it should be. As a beginner in HTML and CSS, I hope this issue wil ...

basic ajax implementation with json

I'm having trouble passing JSON with my jQuery AJAX. Here's my code: var values = {"name":$("#folderName").val(),"dir":directory}; var valstring = JSON.stringify(values); var user = {json:valstring}; $.ajax({ url: "makeFolder.php", ...

Include a new parameter in a JSON object depending on the current value of an existing

{ "data": [{ "prop": "property1", "format": "format1", "group": [{ "name": "Team A", }, { "name": "Team B", }, { "name": "Team C", }] }] } Looking at the JSO ...

The alignment of the text next to the icons is not correct

Is it necessary to use flexbox, or is there an easier way to achieve the same result? It has been a while since I last practiced and I can't seem to remember much. .sadaka-contacts p { color: #115c9b ...

HTML5 CSS and Rails theme

I am currently utilizing a free HTML5 template found at this URL: Despite my efforts, I am unable to successfully implement the background images from the main.js file (bg01.jpg, bg02.jpg, bg03.jpg). How should I correctly reference these image files wit ...

Sending a two-dimensional array through an HTML form field using JavaScript

Prior to reading: Please note that if you are only interested in answering the question, you can skip ahead to "The Question" at the end of this post. My current project involves developing a feature for a website that enables users to upload and share pr ...

What is the best way to retrieve the current value of a header cell, including any nested headers?

My handsontable has headers that include checkboxes and select boxes. How can I access the headers to check the value of a select/checkbox inside the header cell? You can view an example in this JSFiddle (with nested headers - same as my project): http:/ ...

When using an HTML dropdown select to display a list of generated users, only the value of the first user

I have a template that fetches a list of users from the database, and each user row contains a dropdown select option to change their user type (this is an admin page). My goal is to make the dropdowns submit the changes asynchronously. Currently, I can on ...