We’re going to add links to our page today. The links we’ll use today will take us to other websites. Later we’ll add links that take us to different places in our own site.
The link tag is not <li>. That’s for list elements. The link tag is actually <a>. It’s an anchor. Think of how an anchor links the boat to a certain spot. That’s what your link, or hyperlink, is doing. It’s anchoring to a certain place that you will tell it.
Anchor tags are different from all the others we’ve seen before. They take an attribute. A definition of attribute could be a feature. The specific feature of the link is the URL it is going to. The URL is the web address.
This is what an anchor tag looks like.
<a href=”https://allinonehomeschool.com”>Learn with Lee!</a>
<a></a> Those are the opening and closing tags.
In between those tags > < we find the text that will appear on the page.
The stuff written inside the opening tag, is the attribute, the link, the web address you want to anchor to.
HREF is the hyperlink reference.
An equals sign in coding = assigns what’s on the right to what’s on the left.
This is assigning the hyperlink reference to be my site.
The syntax, all the little details are important. You need the equals sign. You need the quotation marks.
You can copy and paste that onto your page to try it out, but then make your own typing everything out.
- You need to follow my directions here and not copy the code from the video. The Learning-with-Lee site I used in the video is no longer owned by me and is now a site aimed at sending you spam!
Watch the video and see it in the browser.