关于选择器:last-child的运用疑问,.cms-questDetail form .cms-queslist:last-child是哪个?

<div class="cms-questDetail">

    <h5 class="title">大学生消费观调查问卷</h5>

    <p class="desc">您好,我们正在进行一项关于大学生消费观的调查,想邀请您用几分钟时间帮忙填答这份问卷。本问卷实行匿名制,所有数据只用于统计分析, 请您放心填写。 题目选项无对错之分,请您按自己的实际情况填写。谢谢您的帮助。</p>

    <form>

        <div class="cms-queslist">

            <p class="cms-quesname">1、你的性别?</p>

            <div class="cms-quesselect">

                 <input type="radio" name="sex" id="sexMale" value="" checked="checked" />

                 <label for="sexMale">男</label>

                 <input type="radio" name="sex" id="sexFemale" value="" />

                 <label for="sexFemale">女</label>

            </div>

        </div>

         <div class="cms-queslist">

              <p class="cms-quesname">2、你一般每个月花费主要在哪些方面?</p>

             <div class="cms-quesselect">

                 <input type="checkbox" name="spend" id="spend1" value="" />

                 <label for="spend1">伙食</label>

                 <input type="checkbox" name="spend" id="spend2" value="" />

                 <label for="spend2">购买衣物</label>

                 <input type="checkbox" name="spend" id="spend3" value="" />

                 <label for="spend3">日用品</label>

                 <input type="checkbox" name="spend" id="spend4" value="" />

                 <label for="spend4">学习</label>

                 <input type="checkbox" name="spend" id="spend5" value="" />

                 <label for="spend5">娱乐</label>

                 <input type="checkbox" name="spend" id="spend6" value="" />

                 <label for="spend6">通讯</label>

             </div>

         </div>

         <div class="cms-queslist">

             <p class="cms-quesname">3、你一般在哪里购买服饰?</p>

             <div class="cms-quesselect">

                 <input type="checkbox" name="spend" id="spendEat" value="" />

                 <label for="spendEat">网购</label>

                 <input type="checkbox" name="spend" id="spendShop" value="" />

                 <label for="spendShop">路边小摊</label>

                 <input type="checkbox" name="spend" id="spendEat" value="" />

                 <label for="spendEat">特色店</label>

                 <input type="checkbox" name="spend" id="spendShop" value="" />

                 <label for="spendShop">百货商城</label>

                 <input type="checkbox" name="spend" id="spendEat" value="" />

                 <label for="spendEat">小店</label>

                 <input type="checkbox" name="spend" id="spendShop" value="" />

                 <label for="spendShop">其他</label>

                 <input type="text" id="" value="" placeholder="请注明" />

             </div>

         </div>

         <div class="cms-queslist">

             <p class="cms-quesname">4、你对本次调查有什么建议或意见?</p>

             <div class="cms-quesselect">

                  <input type="text" id="" value="" placeholder="请输入你的建议" />

             </div>

         </div>

        <input type="submit" class="cms-tijiao" value="提交"/>

    </form>

</div>


qq_宁静致远
浏览 612回答 1
1回答

业余奶茶品鉴师

.cms-questDetail form .cms-queslist:last-child 选择的是:cms-queslist 的父元素 最后一个子元素,且 class 为 cms-queslist 的元素。因为 cms-queslist 的父元素 最后一个子元素 是 input,所以选不到,如果去掉 最后一个 input,则选择到 “4、你对本次调查有什么建议或意见?”所在的cms-queslist望采纳
打开App,查看更多内容
随时随地看视频慕课网APP