Menu
Coddy logo textTech

HTML Attributes

Part of the Fundamentals section of Coddy's HTML journey — lesson 20 of 60.

In HTML, attributes provide additional information about elements. They are used to define properties of an element, such as its size, color, or behavior. Attributes are always specified in the start tag and usually come in name/value pairs like name="value".

Here's the general syntax for adding attributes to an HTML element:

<tagname attribute1="value1" attribute2="value2">Content</tagname>

In this example, tagname is the name of the HTML element (e.g., <p>, <strong>, <h3>), attribute1 and attribute2 are the names of the attributes, and "value1" and "value2" are the values assigned to those attributes.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

Cheat sheet

HTML attributes provide additional information about elements and are specified in the start tag using name/value pairs:

<tagname attribute1="value1" attribute2="value2">Content</tagname>

Attributes define properties like size, color, or behavior of HTML elements.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals