Tuesday, November 24, 2009

Cool HTML Codes For Websites

As you surf the Web, your browser displays the title of each Web page you view within the browser's title bar (across the top of the browser application window). The Web page title gives the name and describes, in a few words, the purpose of the Web page.

To create a Web page title, insert the title's text between start and end title tags (<> < /title >) in the header section of the Web page HTML, as shown in the following code:

<>

<>

<>Welcome to "my" page - Description (in a few words) < /title >

< /head >

<>

...The content the Web browser displays goes

here...

...This is essentially cool HTML code for websites...

< /body >

< /html >

ach Web page title should describe the contents of the page to your site visitors. Every time a visitor glances at the application window's title bar, the page title should remind him or her of the name and purpose of the Web page currently displayed by the browser. On a Web site containing many pages, page titles act as road signs. However, titles do more that remind visitors of their current location on your Web site.

Titles are also used for the following:

  • Web browsers use title text when a visitor bookmarks a page, that is, when the visitor adds a Web page to the list of Favorites in Internet Explorer or to the list of Bookmarks in Mozilla Firefox. Using a title like Home Page does not help to identify your site among the other bookmarks on the visitor's system.
  • Spiders (automated Web search programs) use title text when listing your Web page on search engines. Again, a title like Home Page does not provide useful information. Use descriptive wording in your titles-words visitors might enter into the search field for a search engine when trying to find your Web site.
  • Title text helps you, the Web author, manage and control large multipage sites. Think of a title as a heading that identifies the page. If your Web site contains fifteen pages, the titles help you to locate quickly the page with which you want to work. For example, a real estate site might use the title to indicate pages with Houses for Rent, or Houses for Sale.

In addition to these roles, the W3C considers a Web page without a title as invalid or illegal. The term "illegal" as used here does not mean that someone will arrest you for creating pages without

titles. However, the use of titles helps all Web authors create standardized pages.

One of the best ways to learn cool HTML code for websites, tricks and techniques is to view the HTML statements used in Web pages you encounter as you surf the Web. To view the HTML source code for a Web page, select View | Source from within your browser. (If you are using Mozilla Firefox, select View | Page Source.) As you examine Web pages, you will find that many HTML documents have a document type tag (< !doctype >) at the start of the Web page.

The Document Type Definition (DTD) identifies the version of HTML used to create the Web page. This information is important to Web browsers, HTML validation programs, and to other software programs used for Web design and layout. To validate an existing HTML document go to http://validator.w3c.org. The HTML validation program checks the organization and syntax of the Web document based on the information supplied within the DTD. When the declaration indicates that the document adheres to a strict version of HTML 4.01, the validator judges the Web page based on the HTML 4.01 standard and generates a report with the results of the examination.

In the future, knowing the version of HTML used to create a page will help Web browsers and other programs display Web pages with greater accuracy. In fact, the W3C considers a Web page created with HTML version 4 as invalid unless the HTML document starts with a DTD. The DTD goes at the top of the HTML document before the <> tag. The following shows the correct format for a typical DTD:

< !doctype html public "version name" "url" >

  • html - Identifies the code as a version of the HTML.
  • public - Identifies the language as accessible by the public.
  • version name - Identifies the complete name for the specific version of HTML. For example, the complete name for HTML 4.0 is -//W3C//DTD HTML 4.01 Transitional//EN.
  • url - Indicates where on the World Wide Web a public definition of the HTML code resides, such as www.w3.org/TR/html4/loose.dtd.

A valid DTD for a Web page described using HTML version 4.01 would be as follows:

< !doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"

www.w3.org/TR/html4/loose.dtd >

The loose.dtd option in the previous code declares that the document may include all the elements allowed in the HTML 4 "strict" standard, additional presentation description attributes, and may include deprecated elements. Conversely, using strict.dtd in the DTD would declare that the document strictly adheres to the HTML 4 standard. The strict version of HTML 4.01 emphasizes the structure of the HTML document over the presentation of the page within the Web browser. This does not mean that strict version of HTML 4.01 downplays the presentation of the Web page; it simply focuses on the structure of the HTML markup code. Deprecated tags and elements such as frames and link targets are not allowed in HTML strict. A third Document Type Definition, frameset.dtd, is used when validating HTML documents containing frames.

Currently, neither Mozilla Firefox nor Internet Explorer require that you include a DTD before the start of your Web page HTML, that is, before the start HTML tag (<>) at the top of your Web document. However, you should include one at the start of any Web page you code using HTML version 4.0 or later. The W3C is giving you a hint here. What is optional today may be required in the near future. Therefore, stay ahead of the game and use the DTD in all your Web pages now.

HTML comments are a way to remind you and anyone who works on your HTML documents of what exactly you were thinking when you created a particular Web page. You can use comments to explain specific portions of a document. You can also use comments to insert personal information like your name, address, and phone number in the Web page HTML, so anyone interested in obtaining your services as a Web designer will know how to contact you.

In addition, you might use comments to temporarily hide some of the Web document's HTML statements from the Web browser. Suppose, for example, you want to add a section of some HTML code to an existing document, but you do not want the browser to display the new content until management gives permission to proceed. Placing HTML comment tags (< !- - - - >) around the statements you want to hide instructs the Web browser to ignore the statements until you remove you comment tags.

To create a comment, enclose the informational text (or the HTML statements you want to comment out) within the start and end comment tags, such as < ! - - comment - - >.

Placing a begin comment tag before each line of text or HTML statement is not necessary; the Web browser will ignore anything it finds after the start comment tag and before the next end comment tag. Although the Web browser does not display the information you place between start and end comment tags onscreen, a site visitor can still read the comments by instructing the Web browser to display the Web page HTML.Even some newer versions are better than the old ones, like Firefox 3.5, the Faster Version of 3.0, or Internet Explorer 8 more reliable than the 7 version, you can adapt the code in order to get a good visibility of your web page.

No comments:

Post a Comment