- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Style isolation Property
The HTML DOM style isolation property is for defining if the element must create a new stacking content or not. This property is mainly used for preventing the element from blending in the background by creating a separate stack element.
Following is the syntax for −
Setting the isolation property −
object.style.isolation = "auto|isolate|initial|inherit"
The above properties are explained as follows −
Value | Description |
---|---|
auto | Thisis default property for setting the height. |
length | Thisis for defining the height in length units. |
% | Fordefining the height relative to parent element in percentage. |
initial | Forsetting this property to initial value. |
inherit | Toinherit the parent property value |
Let us look at an example for the isolation property −
Example
<!DOCTYPE html> <html> <head> <style> #demo{ background-color: lightpink; width: 250px; height: 250px; } #demo2{ width: 100px; height: 100px; border: 3px solid red; padding: 4px; mix-blend-mode:difference; } </style> <script> function changeIsolation() { document.getElementById("demo1").style.isolation="isolate"; document.getElementById("Sample").innerHTML="The inner div has now been isolated"; } </script> </head> <body> <div id="demo"> <div id="demo1"> <div id="demo2"> INNER DIV </div> </div> </div> <p>Change the isolation mode for the inner div by clicking the below button</p> <button onclick="changeIsolation()">Change Isolation</button> <p id="Sample"></p> </body> </html>
Output
On clicking the “Change Isolation” button −
Advertisements