![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
How to specify that the styles only apply to this element's parent element and that element's child elements in HTML?
Use the scoped attribute to specify that the styles only apply to the parent element and the element’s child elements −
Example
<!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>
Advertisements