CSS允许我们追加(:after)或是预加(:before)内容,用于动态内容及静态内容(attr()),图像(url())和计数内容(counter())属性。
对想要在鼠标经过时显示一些信息的情况非常好用。
实例代码:
<style type="text/css"> ul li:hover:after { content: attr(title); } </style> <ul> <li id="myList" title="use css to append info for list">hello,css!====</li> </ul>
当鼠标经过hello,css!====时,其后面就会出现use css to append info for list