sel1 + sel2Seleciona los elementos que cumplan con el selector de la derecha y que sean hermanos inmediatamente después de los elementos de la izquierda. No se toma en cuenta el contenido tipo texto.
| 1 | <!DOCTYPE html> |
| 2 | <html lang="es"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" |
| 6 | content="width=device-width"> |
| 7 | <title> |
| 8 | Selector sel1 + sel2 |
| 9 | </title> |
| 10 | <style> |
| 11 | /* Selecciona todos los |
| 12 | * strong |
| 13 | * inmediatamente después de |
| 14 | * em */ |
| 15 | em+strong { |
| 16 | background-color: yellow; |
| 17 | } |
| 18 | </style> |
| 19 | </head> |
| 20 | <body> |
| 21 | <h1> |
| 22 | Selector |
| 23 | <em>sel1</em> |
| 24 | <strong>+</strong> |
| 25 | <em>sel2</em> |
| 26 | </h1> |
| 27 | <p> |
| 28 | <em>Este</em> |
| 29 | <strong>ejercicio</strong> |
| 30 | está |
| 31 | <em>muy</em> |
| 32 | divertido |
| 33 | <strong>ggg</strong> |
| 34 | <em>jajaja</em> |
| 35 | <!-- subíndice --> |
| 36 | <sub>jejeje</sub> |
| 37 | <strong>jijiji</strong> |
| 38 | 🤣🤣🤣. |
| 39 | </p> |
| 40 | </body> |
| 41 | </html> |