当您选择交叉线时,上图显示了黄色区域之外不需要的红色选择。我想在黄色部分内选择,如下所示:
HTML:
<div id="parent">
<div id="child">
This is some content... This is a long lonnnnnnng content.
</div>
</div>
CSS:
#parent {
width: 200px;
background-color: #666;
}
#child {
padding: 50px;
background-color: #ff0;
}
::selection {
background-color: #f00;
}
你知道如何实现这一目标吗?
在这里运行代码:http: //jsfiddle.net/3AESf/