我不知道为什么会这样:
input[ type = "text" ]:last-of-type:focus{ border:1px solid red; }
但这行不通:
input[ type = "checkbox" ]:last-of-type:checked{ border:1px solid red; }
“border”属性只是一个例子,任何其他属性也是如此,请忽略!
最佳答案
给定:
<!DOCTYPE HTML>
<meta charset="utf-8"/>
<title>Testing</title>
<style>
input[ type = "checkbox" ]:last-of-type:checked{ top: 100px; }
input[type='checkbox'] { position: absolute; top: 200px; }
</style>
<h1>Testing</h1>
<form>
<input type="submit" />
<input type="checkbox" />
</form>
它在我的 Chrome 中完美运行。大概您没有尝试使用您正在测试的浏览器中的复选框上的任何属性。
关于CSS3 选择器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5433003/