HTML attributes
Extra information added to an HTML opening tag as a name="value" pair, such as class="header" or href="page.html".
What it does: id="main-title" follows the name="value" format. It is placed inside the <h1> opening tag. Three attributes are listed in the opening tag, each separated by a space - no commas or other separators. Attributes always go in the opening tag, never in the closing tag. For example: <p class="note"> not </p class="note">. Attribute values must be wrapped in double quotes. class="header" is correct; class=header without quotes is invalid. href is used on <a> elements to specify the destination URL. src is used on <img> and <script> elements. class="intro" is an attribute that assigns the CSS class 'intro' to the paragraph element.
Common mistakes: The attribute value must be wrapped in double quotes. The correct form is class="intro" not class=intro without quotes. There must be no spaces around the equals sign in an attribute. The correct form is class="main" not class = "main" with spaces.
Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
attributeFill in the Blanks
Spot the Error
Create a free class, add this module to a journey, and track who's stuck.
Create a free teacher account →No credit card. No setup fee. Make a class and invite students in under three minutes.
Practice this topic interactively, track progress, and unlock badges.
Start Learning Free →