是否可以组合以下 div:after...
.homepage .tm-toolbar:after {
display: inline-block;
width: 196px;
height: 196px;
margin-top: -107px;
margin-left: 60px;
content: "";
background: url("../../../../../images/logo/logo_big.png"); no-repeat 0 0;
background-size: 100%;
}
使用悬停选择器可以更改图片?
有没有办法为整个div/图片设置链接?
非常感谢您。
最佳答案
你只需要这个:
.homepage .tm-toolbar:hover:after{
background: url("../../../../../images/logo/logo_big2.png"); no-repeat 0 0;
background-size: 100%;
}
这里有一个 fiddle 展示了这个工作:http://jsfiddle.net/etgm0v8g/
如果它在您的页面上不起作用,则问题可能出在其他地方。 你检查过你的选择器了吗?
或者您的图像路径? (试试绝对路径)
此外,您不能在伪元素上设置链接。 CSS 应该只用于设计,而不是内容。
关于html - 组合 div :after with url link and hover selector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27443858/