CSS 中的伪元素 ::before 的作用是给被选中元素之前添加效果用法:<!DOCTYPE html><html> <head> <meta charset=“utf-8”> <title></title> <style> .book::before { content: ‘《’; color: blue; } .book::after { content: ‘》’; color: red; } </style> </head> <body> <div class=“book”> JavaScript高级程序设计 </div> </body></html>