Nice work! The webpage is starting to come together.
What if you wanted to link users to a different webpage? The HTML anchor element makes it possible to do this with a single click.
<a href="http://google.com">Click here for Google!</a>
Anchor elements use an attribute to link users to websites. Attributes customize the behavior or appearance of HTML elements. Anchor elements use the
href attribute, which specifies the webpage to link to. In the example above, the text “Click here for Google!” links to
IMPORTANT: Web addresses, such as
http://google.com, have a technical name: URL.
Let’s create an anchor element to send visitors to a webpage that lists cities where Ollie bike sharing is available.
Between the opening
<p> and closing
</p> tags, after the last sentence, enter this text:
Here is a list of cities where you can find us.
Run your code to continue.
Next, use an anchor element to link the word “list” to the URL
Here is a <a href="cities.html">list</a> of cities where you can find us.
cities.html is within the Ollie site folder, so we do not need to specify a full URL
When you have added the anchor element, run your code.
In the web browser, you will now see the word “list” underlined, indicating that the word is a link. Click on the link to test it out!