HTML Attributes

Let's edit our basic HTML:

<!DOCTYPE html>
  <title>My Page</title>
  Hi, here is some text.

and turn the background green. We can add a style attribute inside the <body> tag:

<body style="background-color: green">

The page then looks like this:

web page with green text

Attributes provide useful information that relates to the HTML element. For example, when you create a link in HTML, you provide an attribute that tells the browser where to send the user when the user clicks on the link.

Next: How to add a line break in HTML


Leave a comment

What color are brown eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.