点击左侧按键tab html,按下“tab”键时,内容移动到左侧 - html代码 - 源码查

问题

I was creating something more complex than the code snippet bellow, until I encountered a bug.

If you click on the textfield, then hit Tab, the textfield and its' siblings move way over to the left side.

What is causing this, and how can I stop it from happening?

(The reason there are so many unnecessary divs, is because as I said before, this is from a much more complex project. I narrowed it down to the following.)

nYp8cnV.jpg

解决方法

You're tabbing to the next element: the image.

If you hit SHIFT-TAB (reverse tab function in Windows), you'll end up back in the input.

The effect is caused by child elements being larger than their containers. If you switch the overflowing elements from width: 940px to width: 100%, the shifting effect is removed.

tabindex

With the tabindex attribute you can control the tabbing order.

Elements with a positive value are navigated first, in chronological order

Elements that don't support tabindex or have a value of 0 tab next, in HTML source order

Elements with a negative value (e.g. tabindex="-1") cannot receive focus via tabbing

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值