Code Thuộc tính user-select trong CSS
Code Thuộc tính user-select trong CSS
Code Thuộc tính user-select trong CSS
Tự code rồi chạy thử...
Chạy Thử
<!DOCTYPE html>
<html>
<head>
<title>Code Thuộc tính user-select trong CSS</title>
<style>
p{background:#000;color:#fff;padding:10px}
#none{
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
#all{
-webkit-user-select: all; /* Safari */
-ms-user-select: all; /* IE 10 and IE 11 */
user-select: all; /* Standard syntax */
}
#text{
-webkit-user-select: text; /* Safari */
-ms-user-select: text; /* IE 10 and IE 11 */
user-select: text; /* Standard syntax */
}
</style>
</head>
<body>
<h1>Code Thuộc tính user-select trong CSS</h1>
<span>Dùng để cài đặt không cho phép hoặc cho phép bôi chọn văn bản trên một phần tử HTML, thường bôi chọn để copy, ngoài ra còn có thể cài đặt khi click vào phần tử thì sẽ bôi chọn được tất cả văn bản trên phần tử HTML đó:</span>
<p id="none">user-select: none; Không cho phép bôi chọn để copy hay làm gì khác</p>
<p id="all">user-select: all; Click vào để chọn tất cả văn bản</p>
<p id="text">user-select: text; Cho phép bôi chọn văn bản</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Code Thuộc tính user-select trong CSS</title>
<style>
p{background:#000;color:#fff;padding:10px}
#none{
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
#all{
-webkit-user-select: all; /* Safari */
-ms-user-select: all; /* IE 10 and IE 11 */
user-select: all; /* Standard syntax */
}
#text{
-webkit-user-select: text; /* Safari */
-ms-user-select: text; /* IE 10 and IE 11 */
user-select: text; /* Standard syntax */
}
</style>
</head>
<body>
<h1>Code Thuộc tính user-select trong CSS</h1>
<span>Dùng để cài đặt không cho phép hoặc cho phép bôi chọn văn bản trên một phần tử HTML, thường bôi chọn để copy, ngoài ra còn có thể cài đặt khi click vào phần tử thì sẽ bôi chọn được tất cả văn bản trên phần tử HTML đó:</span>
<p id="none">user-select: none; Không cho phép bôi chọn để copy hay làm gì khác</p>
<p id="all">user-select: all; Click vào để chọn tất cả văn bản</p>
<p id="text">user-select: text; Cho phép bôi chọn văn bản</p>
</body>
</html>
Code Thuộc tính user-select trong CSS nằm trong bài viết Thuộc tính user-select trong CSS