用浮点数在HTML中双击文本选择 [英] Text selection on double click in HTML with a float
问题描述
使用后面的代码:
With the subsequent code :
<span>Label1 Label2</span>
<span style="float:left"><span>Value</span></span>
为什么会出现这种情况?
when double-clicking on the "Value" word, Label2 is selected (highlited) but not Label1. Why is this the case ?
我可以做些什么来只选择Value这个单词而不是Label单词?
What can I do to select only the "Value" word and none of the "Label" words ?
现场示例: http://codepen.io/anon/pen / IHDzj
编辑:此错误仅在Chrome中存在
this bug only exists in Chrome
推荐答案
这可能是Chrome的问题。因为在Firefox中它工作正常。然而,要在chrome中解决它,只需在第一个span标签关闭之前添加空格,如下所示。
This is possibly the Chrome issue. Because in Firefox it works fine. However to solve it in chrome just add space before closing of first span tag as shown here.
<span>Label1 Label2 </span>
<span style="float:left"><span>Value</span></span>
因为每当我们通过双击来选择一个文本的时候。并且这个bug已经在铬问题中被解雇了。
Because whenever we select a text by doubleclicking it.The word as well as white space got selected in chrome and this bug has already fired in chromium issue.
这篇关于用浮点数在HTML中双击文本选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!