::selection 背景色失效最常见原因是浏览器默认样式覆盖或优先级不足,且仅支持 color、background-color、text-shadow(仅 Firefox)、cursor 四个属性,必须同时写标准、-moz-、-webkit- 三版本。
为什么::selection::selectionborderpaddingmargintext-shadowbackground-colorcolorbackgroundtransparent::selectioncolorbackground-colortransparentrgba(0,0,0,0)text-shadow::selectioncursorfont-sizeline-heightbackground-image-webkit-::selection::selection {
background-color: #ff9e6d;
color: white;
}
::-moz-selection {
background-color: #ff9e6d;
color: white;
}
::-webkit-selection {
background-color: #ff9e6d;
color: white;
}::-moz-selectiontext-shadow::-webkit-selection::selection, ::-webkit-selection::selectionuser-selectuser-select: noneuser-select: text::selection::selection!important::selectionforced-colors: active::selection
、
),且确保其
user-select
未被意外禁用。
相关文章
- css如何用flex制作响应式图片墙_通过flex-wrap和flex-grow布局
- 实例教程 HTML5 Canvas 超炫酷烟花绽放动画实现代码_html5教程技巧
- HTML怎么做拖拽列表动画_html拖拽排序列表过渡动画【必看】
- JavaScript中判断对象类型的几种方法总结_基础知识
- nodejs模板引擎是什么
- Express.js中PUT请求更新用户密码的路由参数配置指南
- HTML怎么解决安卓键盘遮挡_HTML安卓软键盘遮挡输入框【推荐】
- 如何用BOM检测用户的浏览器类型和版本?
- Extjs实现进度条的两种便捷方式_extjs
- JavaScript持续集成_GitHub Actions配置
