htmlbeginner
HTML Basics Quiz
Tags, elements, attributes, semantic HTML, and document structure.
7 questions
By EZ4Code Team
1. Which tag represents the largest heading in HTML?
<h1>
<h6>
<head>
<header>
Explanation: `<h1>` is the largest (most important) heading. Headings go from `<h1>` (largest) to `<h6>` (smallest). `<head>` contains document metadata, and `<header>` is a semantic sectioning element (not a heading).
2. Which attribute makes an image accessible?
<img src="logo.png" alt="Company logo">alt
title
description
aria
Explanation: The `alt` attribute provides alternative text for screen readers and is shown when the image fails to load. It's required for accessibility. `title` shows a tooltip. There's no `description` attribute, and `aria` is a prefix for ARIA attributes (like `aria-label`).
3. Which element creates a hyperlink?
<a href="https://example.com">Visit</a><a>
<link>
<href>
<url>
Explanation: `<a>` (anchor) creates hyperlinks with the `href` attribute. `<link>` is for external resources like stylesheets (in the `<head>`). `<href>` and `<url>` are not HTML elements.
4. Which is a semantic HTML5 element?
<div>
<span>
<article>
<b>
Explanation: `<article>` is semantic — it represents self-contained content (a blog post, news item). `<div>` and `<span>` are generic containers with no meaning. `<b>` is presentational (bold). Semantic elements improve accessibility and SEO.
5. What does the `<!DOCTYPE html>` declaration do?
Tells the browser to use HTML5 standards mode
Imports a stylesheet
Declares the page title
Creates a comment
Explanation: `<!DOCTYPE html>` tells the browser to render the page in standards mode (HTML5). Without it, browsers may enter "quirks mode" with non-standard behavior. It must be the very first thing in the document.
6. Which input type creates a checkbox?
<input type="checkbox" name="agree">checkbox
check
boolean
tick
Explanation: `<input type="checkbox">` creates a checkbox. Other types include `text`, `password`, `email`, `radio`, `submit`, `number`, `date`, etc. There's no `check`, `boolean`, or `tick` type.
7. Which tag is used for the most important content of a page (visible to users)?
<body>
<head>
<main>
<html>
Explanation: `<body>` contains all visible page content. `<head>` contains metadata (not visible). `<main>` is a semantic element for the main content area (a child of `<body>`). `<html>` is the root element containing both `<head>` and `<body>`.