我有一个个人页面:http://matthieu.riegler.fr/index.html
我想在其中隐藏一个“小” trollface,仅当选择了文本时才会显示。
知道我该怎么做。
那就是我所拥有的。
#trollface {
float:left;
color: #F5FAFF; /* color of my background */
margin-top: -45em;
}
它有效,但我认为它有点混乱。
有什么办法可以帮助我吗? :)
谢谢
最佳答案
您可以将选定的文本作为CSS规则的目标:
*::selection {
color: ...
}
*::-moz-selection {
color: ...
}
您可以尝试以这种方式放置背景图像。