Thursday, October 25, 2007

Learn some basic HTML

Basic link stuff...

The basic link

The HTML code looks like this:

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

and the resulting link looks like this:

yahoo

Adding target=" _blank" immediately after the URL forces the link to open in a new window.

The HTML code looks like this:

<a href="http://www.yahoo.com/" target="_blank" >yahoo</a>

and the resulting link looks just the same:

yahoo

The concept of an anchor

An anchor is simply marking a "spot" on your page where you would like to be able to link to. For example this post is near the top of my blog and I make reference to a section that I have located at the footer of my blog. I can insert:

<a name="SPOT"></a>

into the HTML code for my blog at that section in my footer where I want to link to. Then I can make a link to that anchor, or "spot" like this:

<a href="#SPOT">Take me to your footer!</a>

Note that there is a pound sign, '#', in front of the name you gave your "spot". This indicates, in HTML parlance, that this link is a local link, referencing something internal to this page.

The link will look like this:

Take me to your footer!

This link does not work, cuz I don't have it setup here on my blog. I will have to mess around to get that to work, I think, I haven't tried it yet.

Speaking of links not working. That kind of thing happens. Did you know you can build in a fail safe for just such a case? In your header you can insert:

<base href="http://www.vesparich.blogspot.com/">

and then any link that doesn't work should just direct the user back to your main page. This is only if YOU FUBAR your link code, I believe, and will not help if, say, the page you link to is not found.

Shout out to Tizag for supplying me with this information to distill and disseminate to you.

1 comments:

Graham Bedwell said...

Hi, interesting blog but I would liked to have read more. Thanks.Graham, my website - www.logo-n-stitch.co.uk