
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Style Last Child
Elements with CSS
To style every <p> elements that is the last child of its parent, use the CSS :last-child selector. You can try to run the following code to implement the :last-child selector
Example
<!DOCTYPE html> <html> <head> <style> p:last-child { background: orange; } </style> </head> <body> <p>This is demo text1.</p> <p>This is demo text2.</p> <p>This is demo text3.</p> </body> </html>
Output
Advertisements