Vous êtes sur la page 1sur 3

ignore me code <!

---> allows you to insert comments into an HTML document and have them complet ely ignored by the browser. This is useful for such things as revision histories and notes about how to improve the document. For example, this code <!-- Creation Date: June 21, 1996 --> <!-- Modifications: --> <!-- Sep 26, 1996: Added Links to Steve's Page --> <!-- Oct 10, 1996: Updated product list --> ########################################################## The <!DOCTYPE ...> declaration (technically it's not a "tag") should be the very first thing in your document... if you choose to use it at all. <!DOCTYPE ...> tells the browser what version of HTML you are writing in. More specifically, <! DOCTYPE ...> declares that this document conforms to a specific version of HTML, and specifies what version that is. The necessity of <!DOCTYPE ...> is a subject of much debate. The standards publi shed by W3C require the use of <!DOCTYPE ...>. However, much of the HTML being w ritten does not conform strictly the W3C specifications, and so using <!DOCTYPE ...> (which is, after all, a claim that you conform to the standards) would seem unnecessary. This is the <!DOCTYPE ...> declaration for HTML version 3.2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> For HTML 4.0, the situation is a little more complicated. There are three standa rd doctypes. The DTD for documents that strictly conform (don't use any deprecat ed markup) and that aren't frameset documents, use this <!DOCTYPE ...>: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> For a not quite so strict conformance (uses some of the deprecated markup such a s <CENTER ...>), use this <!DOCTYPE ...>: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> Finally, for documents which are frameset documents (the "top" document in a fra med page), use this <!DOCTYPE ...>: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd"> ####################################################### <A HREF="mywebpage.html">My Web Page</A> My Web Page Let's look at each part of that link: <A Says that this is an anchor (<A ...>) tag HREF="mywebpage.html"> Says that the Hypertext REFerence for this anchor is the file "mywebpage.html". When an anchor makes a hypertext reference, we call it a "link". My Web Page This is the text which appears on the web page. This text is usually highlighted in some way, such as coloring it blue, to indicate that it is "hypertext" (if y ou click on it, something happens). </A> Closes the anchor This is the simplest type of anchor, but it is probably the kind you will use by

far the most. ######################################################### Attribute for <A ...> NAME = "text string" NAME gives the anchor a name. Other links target the anchor using that name. Thi s allows you to link to specific places within the page. For example, suppose you have a long page with a section about purchasing. You c ould create a named anchors in the sub-header for that section like this: <H2><A NAME="purchasing">Purchasing</A></H2> Note that the <A ...> tag goes inside the <H2 ...> tags. Unlike an anchor that u ses HREF, a named anchor doesn't change the appearance of the text (unless you s et styles for that anchor) or indicate in any way that there is anything special about the text. The purpose of the name is that another anchor can link to the named anchor. To link to a named anchor, add a hash mark to the end of the URL of the page fol lowed by the name. For example, to link to a section named purchasing within the page called anameexample.html we would create a link like this: <A HREF="anameexample.html#purchasing">Purchasing</A> ###################################################### Attribute for <A ...> TARGET = "_blank" "_parent" "_self" "_top" window name TARGET controls where the new document will be displayed when the user follows a link. Most of the time, clicking on a link simply loads a new document in the s ame window where the link was. However, with TARGET, you can have the new docume nt open in a new window, or if you are using frames, in another frame. TARGET = "_blank" "_blank" opens the new document in a new window. this code produces this <A HREF="newwindow.html" TARGET="_blank">a new window</A> TARGET = "_parent" "_parent" is used in the situation where a frameset file is nested inside anothe r frameset file. A link in one of the inner frameset documents which uses "_pare nt" will load the new document where the inner frameset file had been. Want a more complete explanation? Here's the idea in pictures. For example, this anchor: <A HREF="bigframe.html" TARGET="_parent">bigframe</A> TARGET = "_self" "_self" puts the new document in the same window and frame as the current docume nt. "_self" works the same as if you had not used TARGET at all. this code produces this go to <A HREF="selftarget.html" TARGET="_self">next</A> page TARGET = "_top"

"_top" loads the linked document in the topmost frame... that is, the new page f ills the entire window. this code produces this <A HREF="selftarget.html" TARGET="_top">top</A> TARGET = window name window name is used to put the linked document in a frame or window other than t he frame the link is in. For example, this link <A HREF="recipes.html#Spanish Rice" TARGET=RECIPES>Spanish Rice</A> #################################################### TITLE = "text string" W3C says that TITLE is "an advisory title for the linked resource". The idea is that TITLE gives a description of the linked resource that is more informative t han the URL this code produces this Check out <A HREF="deniseres.html" TITLE="Denise Dodd's Resume">my resume</A>

Vous aimerez peut-être aussi