HTML and CSS Reference
In-Depth Information
Attributes Exposed
This week's interview:
Confessions of the href attribute
Head First: Welcome, href. It's certainly a pleasure to interview as big an attribute
as you.
href: Thanks. It's good to be here and get away from all the linking; it can wear an
attribute out. Every time someone clicks on a link, guess who gets to tell the browser
where to go next? That would be me.
Head First: We're glad you could work us into your busy schedule. Why don't you
take us back to the beginning…What does it mean to be an attribute?
href: Sure. Well, attributes are used to customize an element. It's easy to wrap some
<a> tags around a piece of content, like “Sign up now!” we do it like this: <a> Sign
up now! </a> but without me, the href attribute, you have no way to tell the <a>
element the destination of the link.
Head First: Got it so far…
href: …but with an attribute you can provide additional information about the
element. In my case, that's where the link points to:
<a href="signup.html">Sign up now!</a> . This says that the <a> element,
which is labeled “Sign up now!”, links to the “signup.html” page. Now, there are lots
of other attributes in the world, but I'm the one you use with the <a> element to tell it
where it points to.
Head First: Nice. Now, I have to ask, and I hope you aren't offended, but what is
with the name? href ? What's with that?
href: It's an old Internet family name. It means “hypertext reference,” but all my
friends just call me “href ” for short.
Head First: Which is?
href: A hypertext reference is just another name for a resource that is on the Internet
or your computer. Usually the resource is a web page, but I can also point to PDF
documents…all kinds of things.
Head First: Interesting. All our readers have seen so far are links to their own pages;
how do we link to other pages and resources on the Web?
href: Hey, I gotta get back to work, the whole Web is getting gunked up without me.
Besides, isn't it your job to teach them this stuff ?
Head First: Okay, okay, yes, we're getting to that in a bit…thanks for joining us, href.
Search WWH ::

Custom Search