这是一个小提琴: http://jsfiddle.net/5s7vv/
我想要做的是左边有两个按钮,右边有两个按钮,就像示例一样,但是 button_4 应该是最合适的元素。但是,我只能通过一个简单的浮动权来实现。我应该在标记中更改它们的顺序,但这会破坏用户体验(按钮之间的标签顺序错误),这实际上导致了我的问题。
是否可以按正确的顺序向右浮动两个按钮,并保持其标签索引,当然没有额外的标记。 (将它们包装在div中很容易,但我真的想避免这种情况)。
我知道tabindex属性,但据我所知它没有得到很好的支持......
HTML代码:
CSS:
#container{
width: 200px;
}
#container a{
width: 20px;
height: 20px;
}
.button_1, .button_2{
float: left;
}
.button_3, .button_4{
float: right;
}
.button_1{background-color: blue;}
.button_2{background-color: red;}
.button_3{background-color: green;}
.button_4{background-color: yellow;}