简体   繁体   English

html保护表格中的单元格

[英]html protect th cells in a table

I am trying to disabled th cells in a html table to avoid any clicking problem but it seems that disabled property is not available for this.我正在尝试禁用 html 表中的单元格以避免任何点击问题,但似乎禁用属性不适用于此。

focusout() on click doesn't work very well so I ask for help to find a better solution. focusout()单击时效果不佳,因此我寻求帮助以找到更好的解决方案。

If you want to prevent selecting the text, use CSS property user-select: none .如果您想阻止选择文本,请使用 CSS 属性user-select: none

 .noselect{ -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; } th{ border: 1px solid gray; }
 <table> <tr> <th class="noselect">You can't select this</th> <th>You can select this</th> </tr> </table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM