Martin Francis

Blog (hosted for free at Google)

Martin Francis - Web designer in Bristol


Saturday 29 August 2009

HTML, hyperlinks and images - the basics.

When working in HTML for the first time the very first principle that was is the one of "containment" which means that content must have a tag in front and a tag and the end.

With this blog I have used examples of html code but left off the <> brackets that usually surround the code so that the code is not recognised by the blog text editor.

The next is what links the internet together which is the hyperlinks and these can be a "relative address" where you use the Anchor hyperlink reference or "a href" to go to a local directory and "absolute address" where you use the full hyper text transfer protocol (HTTP) address that you see entered in browsers.

Something that is in the book Heads first HTML & CSS was the terms "Parent" or "grandparent" folders when referring to relative linking.
If the parent folder is the folder that all the code and images are held then any page linking to another page within the parent folder does not need the full HTTP address in it's link.
For example A page would use the tag a href="bpage.html" (inside of <>) then the words describing the link such as "link to B page" then the closing tag /a inside <> brackets.
The full address of "B page" could be placed there after the ahref= but it is not necessary.

If there is another level folder the parent folder, can become the grandparent folder.
If you want to link a page that is held within the lowest level of folder (which you can call the parent folder) and you want to link to a page or image in a higher level folder (which you could call the grandparent folder) then you use the tag
a href="../apage.html" then the description, and then the closing tag.
And this is still addressing the file or page locally.

Useful for long scrolling text is the relative links that are links that point to the Anchor point that is at the top of the page.
You may have seen this this before where sometimes you see a "back to top" link. Of course you get this the other way with the Anchor points throughout the long page with the links to them at the top commonly used in FAQ pages.

Absolute addressing then is only necessary when you want to link to websites outside of the one you are currently looking at.
And so the full HTTP address is used but sometimes you don't want to have the reader/user leaving your website and just simply open a new window with the original window still open then you use:-

a target="_blank" href=http://www.etc etc etc.....

Without the attribute "target=_blank" the reader may leave your website and never come back!!

The next important principle while working on a web page is how your working environment should "mirror" whats on your public or server file.


And lastly a quick word on images.

1. that you should use the "alt" and dimension attributes because they are required for validation.
2. that you can dither a GIF so that you can give the appearance of a graduated colour without going to the generally large file sizes of JPEGS. Which could be handy for a vector diagram such as a company logo with a graduated tine or it could be used for a button or tab like the tab on the browser window a few inches about this text if you are using IE 7. But this is of limited use and JPEGs are still better for photo's.
3. Interlacing where the image appears out of focus and then gradually comes into focus as the page loads fully.

Anyway that's the basics.

No comments:

Post a Comment