Tag Archive | "attribute"

Anatomy of A Tag


This entry is part 4 of 5 in the series Web Coding For People Who Are Tired of Being Called Dummies (click to view in order)

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.

<a href="http://www.google.com">

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:

<br />

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.

Posted in CodeComments (0)


PHVsPjxsaT48c3Ryb25nPndvb18xY29sX2hlaWdodDwvc3Ryb25nPiAtIDIwMDwvbGk+PGxpPjxzdHJvbmc+d29vXzJjb2xfaGVpZ2h0PC9zdHJvbmc+IC0gMjAwPC9saT48bGk+PHN0cm9uZz53b29fM2NvbF9oZWlnaHQ8L3N0cm9uZz4gLSAxNTA8L2xpPjxsaT48c3Ryb25nPndvb180Y29sX2hlaWdodDwvc3Ryb25nPiAtIDEwMDwvbGk+PGxpPjxzdHJvbmc+d29vX2Fib3V0X2J1dHRvbjwvc3Ryb25nPiAtIDwvbGk+PGxpPjxzdHJvbmc+d29vX2Fib3V0X2VuYWJsZTwvc3Ryb25nPiAtIGZhbHNlPC9saT48bGk+PHN0cm9uZz53b29fYWJvdXRfaG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