更改跨元素的文本选择顺序 [英] Alter the order of text selection across elements

查看:27
本文介绍了更改跨元素的文本选择顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有这个

div {
  position:absolute;
  top:0;
}

#right {
  left:50px;
}

#left {
  left:0;
}

<div id="right">World</div>
<div id="left">Hello</div>

当我从左到右选择文本时,它的行为看起来不直观.至少在chrome中,从选择中考虑元素的顺序似乎取决于元素的顺序.有没有办法改变顺序而不改变元素的顺序?

When I go to select the text from left to right, it behaves in a visually unintuitive way. In chrome at least, the order in which the elements get considered from selection seems to depend on the order of the elements. Is there a way to change that order without changing the order of the elements?

推荐答案

尝试一下.

div {
 float:left;
 padding-right:2px;
}

#right {
  left:50px;
}

#left {
  left:0;
}

<div>
  <div id="right">World</div>
  <div id="left">Hello</div>
</div>

这篇关于更改跨元素的文本选择顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆