Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App

HTML | DOM Style isolation Property

Last Updated : 08 Aug, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The DOM Style isolation Property defines whether an element must necessarily create a new stacking context. 

Syntax:

  • Return isolation syntax:
object.style.isolation
  • Set isolation syntax:
object.style.isolation = "auto|isolate|initial|inherit"

Properties:

  • auto: It is the default property value. Using this property, if one of the properties applied to the element requires then only a new stacking context is created.
  • isolate: It states that a new stacking context must be created, without any failure.
  • initial: It sets the isolation property to it's default value.
  • inherit: It inherits the isolation property values of the parent element.

Return Value: It returns stacking context of an element. 

Example-1: Showing Auto Property. 

html
<!DOCTYPE html> <html>  <head>     <title>        HTML | DOM Style isolation Property     </title>     <center>         <h1>Geeks            <button onclick="isolation()">             Press           </button>         </h1>          <h2>           DOM Isolation Property         </h2>     </center>     <h4>       Click on the 'Press' button to       set the property to 'auto'     </h4>      <style>         .p {             background-color: green;             border: 1px solid black;         }                  #p1 {             width: 300px;             height: 100px;         }                  .P {             width: 100px;             height: 100px;             border: 1px solid black;             mix-blend-mode: screen;         }                  #d {             isolation: auto;         }     </style>  </head>  <body>      <div id="gfg" class="p">         <div id="d">             <div class="p P">                 geeksforgeeks             </div>          </div>     </div>      <script>         function isolation() {             document.getElementById(                 "d").style.isolation = "auto";         }     </script> </body>  </html> 

Output:

  • Before clicking on the button: 

  • After clicking on the button: 

Example-2: Showing Isolate Property. 

html
<!DOCTYPE html> <html>  <head>     <title>         HTML | DOM Style isolation Property     </title>     <center>         <h1>           Geeks            <button onclick="isolation()">             Press           </button>          </h1>          <h2>DOM Isolation Property</h2>     </center>     <h4>       Click on the 'Press' button to set the        property to 'isolate'     </h4>      <style>         .p {             background-color: green;             border: 1px solid black;         }                  #p1 {             width: 300px;             height: 100px;         }                  .P {             width: 100px;             height: 100px;             border: 1px solid black;             mix-blend-mode: screen;         }                  #d {             isolation: auto;         }     </style> </head>  <body>      <div id="gfg" class="p">         <div id="d">             <div class="p P">                 geeksforgeeks             </div>         </div>     </div>      <script>         function isolation() {             document.getElementById(                 "d").style.isolation = "isolate";         }     </script> </body>  </html> 

Output:

  • Before clicking on the button: 

  • After clicking on the button: 

Example-3: Showing Initial Property. 

html
<!DOCTYPE html> <html>  <head>     <title>         HTML | DOM Style isolation Property     </title>     <center>         <h1>          Geeks            <button onclick="isolation()">             Press           </button>         </h1>         <h2>DOM Isolation Property</h2>     </center>     <h4>       Click on the 'Press' button to set        the property to 'initial'     </h4>      <style>         .p {             background-color: green;             border: 1px solid black;         }                  #p1 {             width: 300px;             height: 100px;         }                  .P {             width: 100px;             height: 100px;             border: 1px solid black;             mix-blend-mode: screen;         }                  #d {             isolation: auto;         }     </style> </head>  <body>      <div id="gfg" class="p">         <div id="d">             <div class="p P">                 geeksforgeeks             </div>         </div>     </div>      <script>         function isolation() {              document.getElementById(                 "d").style.isolation = "initial";         }     </script> </body>  </html> 

Output:

  • Before clicking on the button: 

  • After clicking on the button: 

Example-4: Showing Inherit Property. 

html
<!DOCTYPE html> <html>  <head>     <title>         HTML | DOM Style isolation Property     </title>     <center>         <h1>           Geeks            <button onclick="isolation()">             Press           </button>          </h1>          <h2>           DOM Isolation Property         </h2>     </center>     <h4>       Click on the 'Press' button to        set the property to 'inherit'     </h4>      <style>         .p {             background-color: green;             border: 1px solid black;         }                  #p1 {             width: 300px;             height: 100px;         }                  .P {             width: 100px;             height: 100px;             border: 1px solid black;             mix-blend-mode: screen;         }                  #d {             isolation: auto;         }     </style> </head>  <body>      <div id="gfg" class="p">         <div id="d">             <div class="p P">                 geeksforgeeks             </div>         </div>     </div>      <script>         function isolation() {             document.getElementById(                 "d").style.isolation = "inherit";         }     </script> </body>  </html> 

Output:

  • Before clicking on the button: 

  • After clicking on the button: 

Note: Internet Explorer does not support this property. 

Supported Browsers: The browsers supported by DOM isolation property are listed below:

  • Google Chrome 41
  • Edge 79
  • Firefox 36
  • Opera 30
  • Safari 8

R

riarawal99
Improve
Article Tags :
  • Web Technologies
  • HTML
  • HTML-DOM

Similar Reads

    HTML | DOM touchcancel Event
    The touchcancel event is used to execute a script when the touch event gets interrupted. It is considered a good practice to include the touchcancel event to clean up the code if the devices interrupt a touch event at different actions.Supported Tags All HTML elements supported by this event. Suppor
    1 min read
    HTML DOM childNodes Property
    The childNodes property returns a node's child nodes as a nodeList object. White spaces and comments are also considered as nodes. The nodes are assigned index numbers, starting from 0. Searching and sorting operations can be performed using index number on the node list. Syntax: elementNodeReferenc
    2 min read
    HTML DOM MouseEvent pageX Property
    The MouseEvent.pageX property returns the horizontal coordinate (in pixels) of the mouse pointer, relative to the entire document (not just the viewport), when a mouse event occurs. This value includes any horizontal scrolling that has been doneSyntax: event.pageXReturn Values: It returns the horizo
    1 min read
    HTML | DOM MouseEvent offsetY Property
    The MouseEvent offsetY property is a read-only property and is used for returning the y-coordinate of the mouse pointer, relative to the target element. The MouseEvent offsetY property returns a number which represents the vertical coordinate of the mouse pointer, in pixels with respect to the scree
    1 min read
    HTML | DOM TouchEvent ctrlKey Property
    The TouchEvent ctrlKey property is a read-only property and used for returning a Boolean value which indicates whether or not the "CTRL" key was pressed when a touch event was triggered. It mostly returns false because generally, touch devices do not have a ctrl key. Syntax : event.ctrlKey Return Va
    2 min read
    HTML DOM MouseEvent screenX Property
    The MouseEvent.screenX property is used to get the horizontal coordinate (in pixels) of the mouse pointer relative to the screen, not the viewport when a mouse event occurs. This value represents the distance from the left edge of the user's screen to the mouse pointer's position.Syntax :event.scree
    1 min read
    HTML | DOM Style fontSizeAdjust Property
    The fontSizeAdjust property controls better the font size if the first choice of font is not available. It sets or returns the font aspect value of the text. Aspect value is the size difference between the lowercase letter "x" and the uppercase letter "X". Syntax: To set the fontSizeAdjust propertyo
    2 min read
    HTML DOM compareDocumentPosition() Method
    The DOM compareDocumentPosition() method is used to compare two nodes and it returns an integer describing where they are positioned in the document. Syntax: node1.compareDocumentPosition(node2) Return Value : This return an integer value and their meaning as follows : 1: This means that the two nod
    3 min read
    HTML | DOM touchstart Event
    The touchstart event is used to execute a script whenever the user touches an HTML element. On touching a particular element, if the touchstart event is associated with it, it can be used to trigger a javascript function. Note: The touchstart event works only on touch screen devices.Supported Tags A
    1 min read
    HTML DOM Image Object
    The HTML DOM Image object represents an HTML <img> element, allowing for dynamic manipulation of images in the document. This object provides various properties and methods to change image attributes like src, alt, width, height, and more, as well as handling image events such as onload and on
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences