本教程操作环境:windows10系统、css3&&html5版本、dell g3电脑。
css3中select的用法是什么user-select 属性规定是否能选取元素的文本。
在 web 浏览器中,如果您在文本上双击,文本会被选取或高亮显示。此属性用于阻止这种行为。
默认值: auto
语法为:
user-select: auto|none|text|all;
其中属性值代表结果如下:
auto 默认。如果浏览器允许,则可以选择文本。
none 防止文本选取。
text 文本可被用户选取。
all 单击选取文本,而不是双击。
示例如下:
<!doctype html><html><head><style> div { -webkit-user-select: none; /* safari */ -ms-user-select: none; /* ie 10 and ie 11 */ user-select: none; /* standard syntax */}</style></head><body><h1>user-select 属性</h1><div>the text of this div element cannot be selected. if you double-click me, my text will not be highlighted.</div></body></html>
输出结果:
(学习视频分享:css视频教程)
以上就是css3中select的用法是什么的详细内容。
