Pour sélectionner des éléments avec des attributs, utilisez le sélecteur CSS [attribute].
Par exemple, attribut alt ou attribut cible, etc.
Vous pouvez essayer d'exécuter le code suivant pour implémenter le sélecteur CSS[attribute],
Démonstration en direct
<!DOCTYPE html> <html> <head> <style> img[alt] { border: 3px solid orange; } </style> </head> <body> <img src = "https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg" height = "200" width = "200"> <img src = "https://www.tutorialspoint.com/videotutorials/images/tutorial_library_home.jpg" height = "200" width = "200" alt = "Tutorials Library"> </body> </html>
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!