我是靠谱客的博主 活泼小土豆,这篇文章主要介绍CSS 自定义选中样式: 伪元素::selection,可以用来自定义用户选中文档的高亮样式,现在分享给大家,希望可以做个参考。

 选中样式

 

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<template> <div class="wrapper"> <div> <p>默认高亮</p> <p class="custom-highlighting">自定义高亮</p> </div> </div> </template> <script> export default { name: "Table", components: {}, data() { return {}; }, methods: { jsFun() { console.log(1); }, }, mounted() { this.jsFun(); }, }; </script> <style lang="scss" scoped> .wrapper { height: 100vh; display: flex; align-items: center; justify-content: center; } p { font-size: 2rem; font-family: sans-serif; } .custom-highlighting::selection { background-color: #8e44ad; color: #fff; } </style>

最后

以上就是活泼小土豆最近收集整理的关于CSS 自定义选中样式: 伪元素::selection,可以用来自定义用户选中文档的高亮样式的全部内容,更多相关CSS内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部