Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSS Selector for First Element with Class</title> <style> .wrapper > .red { background: yellow; } .wrapper > .red ~ .red { background: none; } .red { color: red; } </style> </head> <body> <div class="wrapper"> <div>Random</div> <p class="red">First</p> <p class="red">Second</p> <p class="red">Third</p> </div> </body> </html>