Implementation of CSS mask layer_html/css_WEB-ITnose
偶然发现自己原来写了一个CSS遮罩层,虽然这个东西没什么技术含量,但如果本人离开公司后又遇见此类问题,那么可能又得花些时间来找资料了。所以决定还是把它记下来吧。
直接上代码吧。
第一步,html代码:
Java代码
The above code consists of three parts. popDiv represents the pop-up layer, which pops up when the "Registration Instructions" link is clicked.
And bg represents the mask layer, that is, when the pop-up layer is displayed, the content behind the layer is covered. The last one refers to the displayed link.
The CSS classes of these three parts are as follows:
Css code
- .mydiv {
- #FCF4EA; Or> Border: 1px solid#d00000;
- Text-Align: Center;
- FONT-SIZE: 12px;
- Z-Index: 99;
- left:30%;/*FF IE7*/
- top: 20%;/*FF IE7*/
- margin-left:-150px!important;/*FF IE7 This value is half of its width */
- margin-top:-60px!important;/*FF IE7 This value is half of its height*/
- margin-top:0px;
- position:absolute;/*FF IE7*/
- }
- .note_div{
- width: 700px; 400px;
- overflow:scroll;
- text-align: left;
- padding:15px;
- #ccc;
- filter:alpha(opacity=50);/*IE*/
- opacity:0.5;/*FF*/
- z-index:1;
- position:absolute;/*IE6*/
- }
- There is a very important part, that The problem is that the bg mask layer needs to cover the full screen. This thing is difficult to solve, so we use JQuery to solve it, that is, set the size of the bg when the page is initialized:
$(".bg").width($(document).width());
$ ('.bg').height($(document).height());
- $('.bg').css('left',0); '.bg').css('top',0);
- });
- After having the above foundation, only You need to set the data and mask layer to be displayed through ajax callback when clicking the link, as follows:
- Js code
function showDiv (orgId){ bg").show();
});
} closeDiv(){
- $("#popDiv").fadeOut(1000,function(){
- $("#bg").hide();
- });
- }
- This process is actually relatively simple, but I don’t often do page stuff, so I can’t remember much about CSS. I just knew a little bit and wrote it down.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.
