- 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
CSS Child Selector
Use the child selector, if you want to select all elements immediate children of a specified element.
div > p
Example
You can try to run the following code to implement CSS Child Selector
<!DOCTYPE html> <html> <head> <style> div > p { background-color: orange; } </style> </head> <body> <div> <p>Para 1 in the div.</p> <!-- This is not a Child --> <span><p>Para 2 in the div.</p></span> </div> <p>Para 3 outside the div.</p> </body> </html>
Output
Advertisements