Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >通过创建小测验学习无障碍

通过创建小测验学习无障碍

作者头像
姓王者
发布于 2024-10-31 10:44:21
发布于 2024-10-31 10:44:21
10800
代码可运行
举报
文章被收录于专栏:姓王者的博客姓王者的博客
运行总次数:0
代码可运行

无障碍环境正在使你的网页便于所有人使用——甚至是残疾人。

在这个课程中,你将建立一个测验网页。你将学习诸如键盘快捷键、ARIA 属性和设计最佳实践等无障碍工具。

显示如下

HTML/CSS Quiz

Student Info

Name:

Email:

Date of Birth:

HTML

Question1

The legend element represents a caption for the content of its parent fieldset element

  • True
  • False

Question2

A label element nesting an input element is required to have a for attribute with the same value as the input's id

  • True
  • False

CSS

Can the CSS margin property accept negative values?

Select an option Yes No

Do you have any questions:

SendfreeCodeCamp

San Francisco

California

USA

源码

index.md

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="freeCodeCamp Accessibility Quiz practice project" />
    <title>Accessibility Quiz</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <header>
      <img id="logo" alt="freeCodeCamp" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg">
      <h1>HTML/CSS Quiz</h1>
      <nav>
        <ul>
          <li><a accesskey="S"href="#student-info">INFO</a></li>
          <li><a accesskey="A"href="#html-questions">HTML</a></li>
          <li><a accesskey="v"href="#css-questions">CSS</a></li>
        </ul>
      </nav>
    </header>
    <main>
      <form method="post" action="https://freecodecamp.org/practice-project/accessibility-quiz">
        <section role="region" aria-labelledby="student-info">
          <h2 id="student-info">Student Info</h2>
          <div class="info">
            <label for="student-name">Name:</label>
            <input type="text" name="student-name" id="student-name" />
          </div>
          <div class="info">
            <label for="student-email">Email:</label>
            <input type="email" name="student-email" id="student-email" />
          </div>
          <div class="info">
            <label for="birth-date">Date of Birth:</label>
            <input type="date" name="birth-date" id="birth-date" />
          </div>
        </section>
        <section role="region" aria-labelledby="html-questions">
          <h2 id="html-questions">HTML</h2>
          <div class="question-block">
            <h3><span class="sr-only">Question</span>1</h3>
            <fieldset class="question" name="html-question-one">
              <legend>
                The legend element represents a caption for the content of its
                parent fieldset element
              </legend>
              <ul class="answers-list">
                <li>
                  <label for="q1-a1">
                    <input type="radio" id="q1-a1" name="q1" value="true" />
                    True
                  </label>
                </li>
                <li>
                  <label for="q1-a2">
                    <input type="radio" id="q1-a2" name="q1" value="false" />
                    False
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
          <div class="question-block">
            <h3><span class="sr-only">Question</span>2</h3>
            <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" name="q2" value="true" />
                    True
                  </label>
                </li>
                <li>
                  <label for="q2-a2">
                    <input type="radio" id="q2-a2" name="q2" value="false" />
                    False
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
        </section>
        <section role="region" aria-labelledby="css-questions">
          <h2 id="css-questions">CSS</h2>
          <div class="formrow">
            <div class="question-block">
              <label for="selector">Can the CSS margin property accept negative values?</label>
            </div>
            <div class="answer">
              <select name="selector" id="selector" required>
                <option value="">Select an option</option>
                <option value="yes">Yes</option>
                <option value="no">No</option>
              </select>
            </div>
            <div class="question-block">
              <label for="css-textarea">Do you have any questions:</label>
            </div>
            <div class="answer">
              <textarea id="css-textarea" name="css-questions" rows="5" cols="24"></textarea>
            </div>
          </div>
        </section>
        <button type="submit">Send</button>
      </form>
    </main>
    <footer>
      <address>
        <a href="https://freecodecamp.org">freeCodeCamp</a><br />
        San Francisco<br />
        California<br />
        USA
      </address>
    </footer>
  </body>
</html>

styles.css

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="freeCodeCamp Accessibility Quiz practice project" />
    <title>Accessibility Quiz</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <header>
      <img id="logo" alt="freeCodeCamp" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg">
      <h1>HTML/CSS Quiz</h1>
      <nav>
        <ul>
          <li><a accesskey="S"href="#student-info">INFO</a></li>
          <li><a accesskey="A"href="#html-questions">HTML</a></li>
          <li><a accesskey="v"href="#css-questions">CSS</a></li>
        </ul>
      </nav>
    </header>
    <main>
      <form method="post" action="https://freecodecamp.org/practice-project/accessibility-quiz">
        <section role="region" aria-labelledby="student-info">
          <h2 id="student-info">Student Info</h2>
          <div class="info">
            <label for="student-name">Name:</label>
            <input type="text" name="student-name" id="student-name" />
          </div>
          <div class="info">
            <label for="student-email">Email:</label>
            <input type="email" name="student-email" id="student-email" />
          </div>
          <div class="info">
            <label for="birth-date">Date of Birth:</label>
            <input type="date" name="birth-date" id="birth-date" />
          </div>
        </section>
        <section role="region" aria-labelledby="html-questions">
          <h2 id="html-questions">HTML</h2>
          <div class="question-block">
            <h3><span class="sr-only">Question</span>1</h3>
            <fieldset class="question" name="html-question-one">
              <legend>
                The legend element represents a caption for the content of its
                parent fieldset element
              </legend>
              <ul class="answers-list">
                <li>
                  <label for="q1-a1">
                    <input type="radio" id="q1-a1" name="q1" value="true" />
                    True
                  </label>
                </li>
                <li>
                  <label for="q1-a2">
                    <input type="radio" id="q1-a2" name="q1" value="false" />
                    False
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
          <div class="question-block">
            <h3><span class="sr-only">Question</span>2</h3>
            <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" name="q2" value="true" />
                    True
                  </label>
                </li>
                <li>
                  <label for="q2-a2">
                    <input type="radio" id="q2-a2" name="q2" value="false" />
                    False
                  </label>
                </li>
              </ul>
            </fieldset>
          </div>
        </section>
        <section role="region" aria-labelledby="css-questions">
          <h2 id="css-questions">CSS</h2>
          <div class="formrow">
            <div class="question-block">
              <label for="selector">Can the CSS margin property accept negative values?</label>
            </div>
            <div class="answer">
              <select name="selector" id="selector" required>
                <option value="">Select an option</option>
                <option value="yes">Yes</option>
                <option value="no">No</option>
              </select>
            </div>
            <div class="question-block">
              <label for="css-textarea">Do you have any questions:</label>
            </div>
            <div class="answer">
              <textarea id="css-textarea" name="css-questions" rows="5" cols="24"></textarea>
            </div>
          </div>
        </section>
        <button type="submit">Send</button>
      </form>
    </main>
    <footer>
      <address>
        <a href="https://freecodecamp.org">freeCodeCamp</a><br />
        San Francisco<br />
        California<br />
        USA
      </address>
    </footer>
  </body>
</html>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-09-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
FSWD_1_BasicHtmlCss
本文是香港中文大学《Full Stack Web Development》系列课程中的笔记
用户1147754
2019/05/29
4220
通过创建猫咪相册应用学习HTML
Is your cat an indoor or outdoor cat? Indoor Outdoor What's your cat's personality? Loving Lazy Energetic Submit
姓王者
2024/10/31
1660
通过创建猫咪相册应用学习HTML
Bootstrap学习笔记上(带源码)
☑ 简单灵活可用于架构流行的用户界面和交互接口的html、css、javascript工具集。
牧云云
2022/03/11
4K0
Bootstrap学习笔记上(带源码)
Frontend 入门笔记
仔细想了想,还是不要待在 comfort zone 里,干脆直接学 js 全栈,也可以提高 js 的熟练度。
Clouder0
2022/09/23
5750
Frontend 入门笔记
bootstrap5基本使用
container是最基本的布局。 给一个元素的class赋值为container之后,如果显示屏幕小于576,元素将要横向占满屏幕,但是大于576小于576像素的时候,宽度恒定为540,。就是说你的屏幕很宽的时候,元素永远不会横向占满整个屏幕,与边距有孔隙。但是赋值为.container-fluid的时候,元素永远横向占满屏幕,不会留有孔隙。
Crayon鑫
2023/10/10
8380
bootstrap5基本使用
html基础+常用标签
概述 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记)。相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏览器
程序员同行者
2018/06/22
1.3K0
BootStrap应用开发学习入门
[TOC] 0x00 前言简介 什么是BootStrap? 答:Bootstrap是Twitter 的 Mark Otto 和 Jacob Thornton 开发的推出的一个用于前端开发的开源工具包产
全栈工程师修炼指南
2020/10/23
18.6K0
BootStrap应用开发学习入门
HTML入门案例Demo【猫咪相册】
案例代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CatPhotoApp</title> </head> <body> <main> <h1>CatPhotoApp</h1> <section> <h2>Cat Photos</h2> <!-- TODO: Add link to cat photos -->
百思不得小赵
2023/01/03
6570
HTML入门案例Demo【猫咪相册】
BootStrap应用开发学习入门1
什么是字体图标? 答:字体图标是在 Web 项目中使用的图标字体,可以通过基于项目的 Bootstrap 来免费使用这些图标。
全栈工程师修炼指南
2020/10/23
46.6K0
BootStrap应用开发学习入门1
《HTML5实战》Lesson02
Week02     2016/09/21上午1-4节 一、Modernizr.js的作用 解决不支持css3+html5浏览器的兼容性 Modernizr.js:为HTML5和CSS3而生!-前端开发博客 Modernizr的介绍和使用-刘一痕-ChinaUnix博客 Modernizr.js入门指南 - 推酷 二、Modernizr.js的下载 官方网站: Modernizr: the feature detection library for HTML5/CSS3 GitHub - Mode
用户1733354
2018/04/27
7050
《HTML5实战》Lesson02
Spring Boot 实现员工信息管理demo
在自定义MVC配置中重写一个 addViewControllers ,用来添加一些基本的视图控制器
LCyee
2020/08/05
1.7K0
Spring Boot 实现员工信息管理demo
Html之初体验
概述 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言。相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏览器根据标记
洗尽了浮华
2018/01/22
1.1K0
Html之初体验
jQuery的基本操作
jQuery就是一个js的库· 主要分为两部分:            1·寻找元素         (选择器,筛选器)            2·操作元素          (CSS的操作,属性的操作,文本的处理) 选择器 基本  #id    #id //用于搜索的,通过元素的id属性中给定的值 描述:(查找ID为myDiv的元素) HTML代码: <div id="notMe"><p>id = "notMe"</p></div> <div id="myDiv">id="m
Wyc
2018/09/11
8K0
1.CSS Reset
浏览器对标签进行了默认设置,所以在我们没有定义样式的时候,会有五花八门的效果 不同的浏览器设置的默认样式是由差异,效果也会有差异。 因为浏览器对标签进行设置,所以我们必须额外设置标签的样式,把之前的样式覆盖(reset)掉。
河湾欢儿
2018/09/06
6650
Web前端教程-HTML及标签的使用
1. HTML简介 HTML由标签和属性构成的 1.1. HTML文档基本结构 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>网页标题</title> </head> <body> 网页显示内容 </body> </html> 2. 标签 学习html语言就是学习标签的用法 2.1. 标签语法 长在尖号后面第一个单词就是标签(标记,元素) 一组告诉浏览器如何处理一些内容的标签,通过关键字来识别, <body>, <title>, <m
用户1289394
2021/10/26
1.2K0
html+css学习笔记011-表单
Author:Mr.柳上原 付出不亚于任何的努力 愿我们所有的努力,都不会被生活辜负 不忘初心,方得始终 责任与担当 这几天公司招聘文案 好几个应聘上的孩子 答应的好好的第二天来上班 然而却一去不复返 给公司的工作计划造成了极大的困扰 并不是责备他们 而是从他们身上 看到了以前那任性和不负责任的自己 原来当初我那些自以为小小的无所谓的举动 会给亲人、朋友和同事带来那么大的麻烦 只是他们选择了宽容 <!DOCTYPE html> <!-- 文档类型:标准html文档 --> <html lang='en'>
Mr. 柳上原
2018/09/05
8830
HTML(三)
img 还有 width 和 height 属性来表示图片的宽高,但通常我们不使用这两个属性来更改图片尺寸,只是起到页面内占位的作用。 注意区分下面 4 种写法的异同
1ess
2021/10/29
3230
HTML(三)
【Python3】HTML基础
BS(Browser-Server)模式:顾名思义为浏览器-服务器的意思,对比的话类似我们PC上面浏览器使用的产品即为BS模式产品,例如google doc、各类网站等。
py3study
2020/01/06
9320
阅读Skeleton.css源码,改善睡眠质量(尽管它只有419行代码)
虽然现在大部分业务都不需要重复造轮子了,但对于小白来说,学习完 Skeleton 源码 是能走出新手村的。
德育处主任
2022/04/17
7930
阅读Skeleton.css源码,改善睡眠质量(尽管它只有419行代码)
SpringBoot项目复盘
如果后端数据判断显示为null或者密码错误。通过上述的语法就可以实现将数据回显出来,而不是一开始就显示数据
用户11097514
2024/05/30
1610
SpringBoot项目复盘
相关推荐
FSWD_1_BasicHtmlCss
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档