禁用非输入元素的插入符号?

Sim*_*ton 1 html css caret

对于非输入元素的元素,是否可以在 HTML 文档上禁用闪烁的插入符号?

例如,单击列表项会将插入符号移动到列表项元素:

<ul>
  <li>Cool choice 1</li>
  <li>Cool choice 2</li>
  <li>Cool choice 3</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

如果您有一个ul用于导航的 ,那么您可能希望它们感觉像按钮。如果没有插入符号,这可以实现。这样的事情可能吗?

Vin*_*ney 5

试试这门课

.disableCaret{
  -webkit-user-select: none;  /* Chrome all / Safari all */
  -moz-user-select: none;     /* Firefox all */
  -ms-user-select: none;      /* IE 10+ */
   user-select: none;       
}
Run Code Online (Sandbox Code Playgroud)