Until now we’ve included all of our content within opening and closing HTML tags, but what do we do if we have a self-closing HTML element? There aren’t tags for us to put the content between, so how can we give the browser information about our content?
To do this, we can set an attribute on the tag, which allows us to define more information about the HTML element. We can set attributes on both closing and self-closing elements, and we do this by adding the
attribute to the opening tag, and setting a
value inside of quotes.
You can have multiple different attributes on a tag, and we’ll go through a few of the common ones now.