如何用CSS选择属性值包含指定单词的元素?
使用[attribute ~= "value"]选择器通过CSS选择属性值包含指定单词的元素。
您可以尝试运行以下代码来实现[attribute ~= “值”]选择器。在这里,我们搜索的词是“Tutorials”,
示例
Live Demo
<!DOCTYPE html> <html> <head> <style> [alt ~= Tutorials] { border: 5px solid orange; border-radius: 5px; } </style> </head> <body> <img src = https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg height = 200 width = 200 alt = Tutor Connect> <img src = https://www.tutorialspoint.com/videotutorials/images/tutorial_library_home.jpg height = 200 width=200 alt = Tutorials Library> </body> </html>
以上就是如何用CSS选择属性值包含指定单词的元素?的详细内容,更多请关注双恒网络其它相关文章!