Bonus Chapter: Attributes
What is an Attribute?
An attribute is the inside of an element. Each element is what makes the HTML page. Such as if you were to say the element p means paragraph. The attribute would be the inside coding of the paragraph, like if we wanted to define a CSS class (Which we will get to later) we would do class="blahhh" and put it in the element like this. <p class="blahhh">Paragraph text</p>
An attribute is the inside of an element. Each element is what makes the HTML page. Such as if you were to say the element p means paragraph. The attribute would be the inside coding of the paragraph, like if we wanted to define a CSS class (Which we will get to later) we would do class="blahhh" and put it in the element like this. <p class="blahhh">Paragraph text</p>
Always Quote Attribute Values
Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed.
Tip: In some rare situations, when the attribute value itself contains quotes, it is necessary to use single quotes: name='John "ShotGun" Nelson'
Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed.
Tip: In some rare situations, when the attribute value itself contains quotes, it is necessary to use single quotes: name='John "ShotGun" Nelson'
Here are a few attributes for reference
class - Specifies one or more classnames for an element (refers to a class in a style sheet)
id - Specifies a unique id for an element
style - Specifies an inline CSS style for an element
title - Specifies extra information about an element (displayed as a tool tip)
class - Specifies one or more classnames for an element (refers to a class in a style sheet)
id - Specifies a unique id for an element
style - Specifies an inline CSS style for an element
title - Specifies extra information about an element (displayed as a tool tip)