

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to specify that the styles only apply to this element's parent element and that element's child elements in HTML?
<p style="">Use the <em>scoped </em>attribute to specify that the styles only apply to the parent element and the element’s child elements −</p><h2 style="">Example</h2><pre class="prettyprint notranslate"><!DOCTYPE html> <html> <head> <style> h2 { color:yellow; } </style> </head> <body> <div> <style scoped> h2 { color:grey; } </style> <h2>Grey Heading</h2> </div> <h2>Yellow Heading</h2> </body> </html></pre>
- Related Questions & Answers
- How to specify that the element is read-only in HTML?
- How to specify the language of the element's content in HTML?
- Style every <p> element that is the only child of its parent with CSS
- How to specify that an element is not yet relevant in HTML?
- How to get the child element of a parent using JavaScript?
- How to specify that the element should automatically get focus when the page loads in HTML?
- How to specify that the element must be filled out before submitting the form in HTML?
- Align an element with the bottom of the parent element's font in Bootstrap 4
- Align an element with the top of the parent element's font in Bootstrap 4
- Style every <p> element that is the only <p> element of its parent with CSS
- Select every <p> element that is the second <p> element of its parent, counting from the last child
- Style every <p> element that is the second child of its parent with CSS
- Style every <p> element that is the child of its parent, counting from the last child with CSS
- C# Program to return the only element that satisfies a condition
- How to set that the specified element/group of elements should be disabled in HTML?
Advertisements