Attributes and Links


Attributes provide additional information about the contents of an element. They appear on the opening tag of the element and are made up of two parts: a name and a value, separated by an equals sign. Attributes are also used to modify elements, and are useful when adding links, images, supporting accessibility (for example, alt text and aria labels), adding style with CSS and interactions with Javascript. In today's activity, we are going to attrbutes them to create links. But first, let's examine the fun example of the language attribute


Paragraph in English

Paragraph en Español


<p lang="en">Paragraph in English</p>
<p lang="es">Paragraph en Español</p>

In the examples above, "lang" is the attribute name and "en" and "es" are the values.


The W3School provides a complete list of attributes on the W3school attribute reference


Links are the defining feature of the web because they allow you to move from one web page to another, and enabling the very idea of browsing or surfing. You will commonly come across the following types of links:

Links are created by using the anchor element. There are many different kinds of links you can make, but for now we'll stick with linking to another page (instead of an email address, or an image, or some other service)They also need to include a hypertext reference (directions where to go). To include a reference of our links, we need to use the "href" attribute. Let's check out a couple of link examples. In the first example, we'll demonstrate linking to another web page.

Next: link example 1
Previous: Review of Part 1 Elements