True or false: CSS can change how a semantic element looks without changing the meaning that the element conveys.
2 HTML Structure and Semantics Online Quiz Questions
Use this free practice quiz with 20 questions to review 2 HTML Structure and Semantics, test your knowledge, and prepare for your next test or exam.
True or false: An <img> element must have a closing tag to be valid HTML.
- A
True
- B
False
A page contains a self-contained item that could make sense on its own, such as an independent article. Which element is the best semantic fit?
- A
<article> - B
<div> - C
<footer> - D
<nav>
In a typical HTML document, the contains document information, and the contains the page content.
A control on a page performs an action rather than navigating to another destination. Which HTML element should you use?
- A
<a> - B
<nav> - C
<button> - D
<section>
For a same-page link, the href value points to an element whose id value is .
What exact alt attribute and value should you use for a purely decorative image so assistive technology can skip it?
A sentence is ordinary body text, but a designer wants it to look large. Which approach follows the guidance for headings?
- A
Use a heading element because it is the quickest way to make ordinary text large.
- B
Keep the text in an appropriate non-heading element and use CSS to style it.
- C
Choose whichever heading level produces the preferred appearance.
- D
Replace the text with a
<div>and rely on its default size.
Select all accurate statements about HTML document setup and metadata.
- A
<!doctype html>tells browsers to use modern standards mode. - B
The document's character encoding can be specified in a
metaelement. - C
The document
<title>is shown in the browser tab. - D
The
<title>is the element intended to hold the visible page content.
Explain what semantic HTML contributes to a page and why changing an element's appearance with CSS does not change its semantic meaning.
Select all accurate practices for writing image alternatives.
- A
For an informative image, provide alternative text conveying its relevant information or function.
- B
For a purely decorative image, use an empty alternative value.
- C
When an image is a link, make its alternative help communicate the link's purpose.
- D
Repeat the adjacent caption word for word as the alternative text in every case.
You are marking up a page region containing the site's main navigation links. Which semantic element best describes that region?
- A
<footer> - B
<nav> - C
<article> - D
<section>
A page links to a planting guide, a map, and an events calendar. Which link label best helps someone understand the destination even when the link is encountered outside its paragraph?
- A
“Click here” for every destination
- B
“Download the garden planting guide”
- C
“More” for every destination
- D
“Read this” for every destination
A page has an h2 heading for “Plant care,” followed by a subsection about pruning. Which heading rank best represents the subsection in the content hierarchy?
- A
Use an h1 because the text should stand out
- B
Use an h2 because all section headings should have the same rank
- C
Use an h3 because it is a subsection beneath an h2
- D
Use whichever heading rank produces the desired font size
A page uses CSS to position cards in a grid. What should the developer do in the HTML so that the cards also make sense when read without that visual layout?
- A
Arrange the HTML so the content reads in a meaningful sequence before visual styling is applied
- B
Put all interactive elements at the end of the HTML regardless of their context
- C
Use CSS to make an arbitrary source sequence appear meaningful
- D
Place headings after all the content they describe
A developer is marking up a page with meaningful regions and also needs a wrapper that serves only as a styling hook. Which approach best follows the guidance for accessible markup?
- A
Use div elements for every region and rely on their text to communicate purpose
- B
Use appropriate semantic elements for meaningful regions and reserve div for generic grouping
- C
Use headings in place of all structural elements
- D
Use CSS class names as a substitute for meaningful HTML elements
True or false: Link text such as “View the garden hours” is generally more informative on its own than a repeated label such as “Click here.”
- A
True
- B
False
A page groups related information about visiting hours under its own heading. Which HTML element name best describes this content group?
A developer needs a generic wrapper only to apply a CSS layout rule; it does not represent a meaningful region or related content group. Enter the HTML element name that fits this purpose.
An anchor element should take a reader to a separate page. Which attribute specifies the link’s destination?