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.
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.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
2Text and Formatting
HeadingsParagraphsLine BreaksBold and Italic TextBold and Italic AgainRecap - Formatting8Forms and Inputs Part 1
Form BasicsText InputsInput AttributesPassword FieldLabels for InputsRecap - Basic Form11Event Registration Page
Project OverviewHeader Section9Forms and Inputs Part 2
Radio ButtonsCheckboxesDropdownsButtonsButtons in FormsRecap - Forms #1Recap - Forms #2