我有这个html结构:
<ol class="linenums">
<li class="L0">
<code>
<span><!-- piece of code--></span>
</code>
</li>
</ol>
在代码之前,有行号。 通过选择代码,我使用此css,以便只选择代码而不是亚麻布
ol.linenums li {
-user-select: none;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
ol.linenums li code {
-user-select: all;
-webkit-user-select: all; /* Chrome/Safari */
-moz-user-select: all; /* Firefox */
-ms-user-select: all; /* IE10+ */
}
在每个浏览器(IE,FF,Chrome,Opera)中,只选择代码。除了在 苹果浏览器;根本不可能选择任何东西。
我如何为Safari工作?
答案 0 :(得分:1)
似乎Safari也需要这条线:
-webkit-user-select: text;
现在正在使用此代码:
ol.linenums li code {
-user-select: all;
-webkit-user-select: all; /* Chrome/Safari */
-webkit-user-select: text; /* Safari only */
-moz-user-select: all; /* Firefox */
-ms-user-select: all; /* IE10+ */
}