HTML & CSS Intro Course: Coding Links
Anchor Tag Essentials
Basic Link
<a href='https://example.com'>Visit Example</a> — wraps any inline content.
Internal Links
Use relative paths like /about or anchor IDs like #section-2.
Open in New Tab
Add target='_blank' rel='noopener' for external links.
Email & Phone
href='mailto:you@example.com' and href='tel:+15551234567' open the right app.
Noble Desktop's Full-Stack Web Development Certificate covers HTML, CSS, JavaScript, and the modern web stack.
Within a website, we link between pages and we link to other websites. Let's see how to create links in HTML in this video.
1Full Video Transcript
Within a website we link between pages and we also link to other websites, so let's see how to create links in HTML. Here I have a local HTML page that I've started. I'm going to open it up in my code editor by right-clicking or control-clicking on the Mac and going to Open With and choosing my code editor. I'm going to use Sublime Text, but this will work in any code editor. I want to also take a look at this page just so we can see what it looks like as well, so I'm also going to go back to my desktop and open this up in Chrome. You could be using any browser here, it doesn't really matter.
I can actually put these side by side because there's not a lot of content here. So this is how it looks, and let's say some of the text in here I want to link to another website. We'll start by going to a website. For example, let's say I want to go to microsoft.com or The Onion. These are two different websites that I'll be linking to, so I'll navigate there in my browser just to make sure that I have the address right.
2Understanding HTTP and HTTPS
Now in Chrome, when you first click you're just going to get the basic address here, but if I click again you'll notice the full address here with HTTP. In this case it's S for secure. So what does HTTP mean? We are writing HTML, Hypertext Markup Language, and so that's the markup language that we use to markup or label our content. That's our tagging language. HTTP is the Hypertext Transfer Protocol. So Hypertext Markup Language, Hypertext Transfer Protocol. This is the protocol that's used to transfer the HTML pages.
S is something that a website can optionally have. S is for secure, so if it's a secure site that encrypts the information between you and the server, then it's HTTPS. Sites that have that enabled are going to be more secure, but it's up to the site to make it so. If it's just HTTP, you can't make the site secure by just adding an S if they didn't set up their website as a secure website.
So whatever the address is, whether it's HTTP or HTTPS, just go with whatever they have set up. When in doubt, do the HTTP if you're just not sure, because it should redirect to the HTTPS version, but you should check it out and just see what they do. Here, for example, if I go to the non-secure version, it does redirect to the secure version, but we should link to whatever that website is, whether it's the secure or non-secure version. This is the full address. Some websites will have WWW and some will not. That's just their preference of how they have the website configured.