Let’s breakdown the tag. Tags all start with a base (like strong) but tags can also have attributes. Attributes are like settings for a tag. Here is a snippet containing a link:
Here's a link to <a href="http://www.google.com">Google</a>, friend.
The code above produces:
Here's a link to Google, friend.
The base tag here is called an anchor tag, or just <a> (notice the </a> to end the link). However, an <a> tag isn’t very useful until you give it an attribute, telling it where the link goes. In this case, the attribute is called href. Attributes are set by inserting them into the a tag directly.
Tags can have lots of attributes, but most of them aren’t required. (Here is a big list of tags.) A few more of interest:
This is a break tag. It is analogous to hitting return on your keyboard. After you do it, you move to the next line. Here are two breaks in a row:
Not much to see, right? Just like hitting return. Wait a second, you might be thinking. Why is there a slash after the br? Here’s why: Each tag that is opened must be closed. If you start something in italics with the <em> tag (it’s short for emphasis), then you must close it with with a corresponding </em> tag. However some tags are self-closing, thus the slash at the end. Breaks are like this, as are images.
<img src="images/logo.jpg" />
The <img> tag allows you to put images into your page. The src attribute tells you the address where the browser can find the image. This tag says load the image logo.jpg from the folder images. This address brings up the issue of relative vs. absolute addressing. Onward, dear reader.