cssだけで可能だとは思いませんが、おそらくjavascriptで可能ですが、それは決して良い選択肢ではありません. これを行う方法はありますが、あまり美しくはありませんが、うまくいく可能性があります: テーブルにデータを供給するために php を使用している場合、最初の行とまったく同じデータを持つ非表示の div を 2 行目に作成できます。例えば:
<div class="NoSelect" style="display: inline-block; height: 1px; overflow: hidden;">
--echo here the same data as in the first row--
</div>
内部のテキストを選択できないようにするには、次のように追加します。
<style type="text/css">
.NoSelect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
cursor: default;
}
</style>
<script language="javascript" type="text/javascript">
jQuery.fn.extend({
disableSelection : function() {
return this.each(function() {
this.onselectstart = function() { return false; };
this.unselectable = 'on';
});
}
});
$(document).ready(function() {
$('.NoSelect').disableSelection();
}
</script>