通过编写小测验学习无障碍 - 步骤 31

告诉我们发生了什么:

步骤 31

label 元素添加文本,使 input 在文本之前。 然后,给 input 元素一个与文本匹配的 value

文本应为 TrueFalse

你目前的代码

<ul class="answers-list">
                <li>
                  <label for="q1-a1">
                    <input type="radio" id="q1-a1" value="ture" />aaa
                  </label>
                </li>
                <li>
                  <label for="q1-a2">
                    <input type="radio" id="q1-a2" value="ture" />ggg
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
          <div class="question-block">
            <p>2</p>
            <fieldset class="question" name="html-question-two">
              <legend>
                A label element nesting an input element is required to have a
                for attribute with the same value as the input's id
              </legend>
              <ul class="answers-list">
                <li>
                  <label for="q2-a1">
                    <input type="radio" id="q2-a1" value="ture" />sss
                  </label>
                </li>
                <li>
                  <label for="q2-a2">
                    <input type="radio" id="q2-a2" value="ture" />vvv
                  </label>
                </li>
              </ul>

警告

挑战的种子代码和/或你的解决方案超过了我们从挑战传送的最大长度。

你需要在此采取额外步骤,以确保你写的代码可以轻松地被阅读。

请复制/粘贴所有在挑战中编辑器所显示的代码。

用你的复制代码替换这两句。
请保留上方的 ``` 行和下方的 ``` 行
因为它们允许你的代码在帖子中被正确格式化。

你的浏览器信息:

用户代理是: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.47

挑战: 通过编写小测验学习无障碍 - 步骤 31

挑战的链接:

仔细理解题意哦,是要在 <label></label> 标签里添加文本 “True” 或者 “False”,同时在 <input> 标签里添加对应的 value,即 “true” 或者 “false”。

正确的代码是:

<ul class="answers-list">
                <li>
                  <label for="q1-a1">
                    <input type="radio" id="q1-a1" />
                  </label>
                </li>
                <li>
                  <label for="q1-a2">
                    <input type="radio" id="q1-a2" />
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
          <div class="question-block">
            <p>2</p>
            <fieldset class="question" name="html-question-two">
              <legend>
                A label element nesting an input element is required to have a
                for attribute with the same value as the input's id
              </legend>
              <ul class="answers-list">
                <li>
                  <label for="q2-a1">
                    <input type="radio" id="q2-a1" />
                  </label>
                </li>
                <li>
                  <label for="q2-a2">
                    <input type="radio" id="q2-a2" />
                  </label>
                </li>
              </ul>

另外,这里你是想写 true 吗?字母顺序写错了。