领域集的第一个孩子 [英] first child on a field set

查看:109
本文介绍了领域集的第一个孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个名为myform的表单标签中有2个字段集

I have 2 field sets inside a form tag called myform

我试图访问第一个字段集。现在在fieldsets之前有其他div和p标签。
我正在尝试第一个字段集和最后

I'm trying to get to the first fieldset. Now before the fieldsets there are other divs and p tags. I was trying this for the first fieldset and 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
}


推荐答案

您的HTML不正确。 < myform>< / myform> 应为< form id =myform>< / form>

Your html is incorrect. <myform></myform> should be <form id="myform"></form>

,正确的选择器是 #myform fieldset:first-of-type

此网页是一个很好的参考如何css伪类工作

This page is a good reference on how css pseudo-classes work

这篇关于领域集的第一个孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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