我在名为myform的表单标记中有2个字段集
我正试图进入第一个fieldset.现在在fieldsets之前还有其他div和p标签.我正在尝试第一个fieldset和last
<myform>
<div></div
<p></p>
<fieldset></fieldset>
<div></div>
<fieldset></fieldset>
</myform>
#myform fieldset{
// all round styles for the fieldset
}
#myform:first-child fieldset{
// specific to the first field set
}
#myform:last-child fieldset{
specific to the last filedset
}
Run Code Online (Sandbox Code Playgroud)
这取决于您的浏览器要求,但要定位所有现代浏览器,您可以使用:
#myform fieldset:first-of-type {
}
Run Code Online (Sandbox Code Playgroud)
第一个fieldset.
编辑:您不能使用,:first-child因为第一个fieldset不是它的父亲的第一个孩子,请参阅http://www.w3.org/TR/CSS2/selector.html#first-child
| 归档时间: |
|
| 查看次数: |
4788 次 |
| 最近记录: |