欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 培训 > 浏览器选中文字样式

浏览器选中文字样式

2025/5/21 7:20:22 来源:https://blog.csdn.net/m0_72030584/article/details/144828174  浏览:    关键词:浏览器选中文字样式

效果

学习

  1. Chrome: 支持 ::selection
  2. Firefox: 支持 :-moz-selection 和 ::selection
  3. Safari: 支持 ::selection
  4. Internet Explorer: 支持 :-ms-selection
  5. Microsoft Edge: 支持 ::-ms-selection 和 ::selection

代码

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>浏览器选中文字样式示例</title><style>/*  W3C 推荐的标准选择器,用于设置选中文本的样式  优先级最高,通常会被这些浏览器优先应用*/::selection {background-color: #ff0000;color: #000;}/* Firefox 4-18 */:-moz-selection {color: #ff0000;}/* Internet Explorer 10-11 */:-ms-selection {color: #ff0000;}/* Microsoft Edge */::-ms-selection {background-color: #ff0000;color: #000;}</style>
</head><body><h1>标题</h1><h5>你好!!panda</h5>
</body></html>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词