我想知道,如果属性获取特定类,是否可以使用 CSS 加载背景。为了演示,它应该加载到hover
.
HTML
<div id="testdiv" title="http://www.thesearchagents.com/wp-content/uploads/2013/11/Google-Search.jpg">hover me...</div>
CSS
#testdiv {
line-height:100px;
}
#testdiv:hover {
outline:3px solid red;
background:url(attr(title)) 100%; // > How can I make this work?
}
#testdiv:hover:after {
content:attr(title); // > This works fine...
}
不幸的是,鼠标悬停(悬停)时没有显示背景图像。
(如何)我可以完成这项工作吗?