0% found this document useful (0 votes)
56 views3 pages

Head Element: Title Tag

The head element contains metadata about an HTML document like the title, style instructions, and keywords for search engines. The title tag provides the document title that is not displayed but used for indexing. The base tag allows links to open in a new window. The meta element also provides metadata for browsers and search engines, including describing content and identifying keywords. Scripts can be added to HTML pages to make them interactive using the script tag, and older browsers that don't support scripts can be handled by hiding scripts in comments or using the noscript tag.

Uploaded by

Daniel Veriks
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views3 pages

Head Element: Title Tag

The head element contains metadata about an HTML document like the title, style instructions, and keywords for search engines. The title tag provides the document title that is not displayed but used for indexing. The base tag allows links to open in a new window. The meta element also provides metadata for browsers and search engines, including describing content and identifying keywords. Scripts can be added to HTML pages to make them interactive using the script tag, and older browsers that don't support scripts can be handled by hiding scripts in comments or using the noscript tag.

Uploaded by

Daniel Veriks
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Head Element

The head element <head> contains general information, also called metainformation, about a document. Meta means information about. You can say that meta-data means information about data, or meta-information means information about information. The head element includes important information such as the documents title, style instructions, and more.

title Tag
The documents title information inside a head element is not displayed in the browser window, but is used for indexing and cataloging. The result of the following code is shown in Figure 22.2.

base Tag
The example illustrated in Figure 22.3 demonstrates how to use the <base> tag to let all the links on a page open in a new window.

Meta Element
As discussed earlier in the last section, the head element contains general information (meta-information) about a document. HTML also includes a meta element <meta> that goes inside the head element. The purpose of the meta element is to provide meta-information about the document. Most often the meta element is used to provide information that is relevant to browsers or search engines, like describing the content of your document. The meta attributes in the following example identify the documents author, editor, and the software used to create the page.

Keywords for Search Engines


Information inside a meta element can also describe the documents keywords, which are used by search engines to find your page when a user conducts a search on the keyword. Some search engines on the Web will use the <name> and <content> attributes of the meta tag to index your pages. However, because too many Webmasters have used meta tags for spamming, like repeating keywords to give pages a higher search ranking, some search engines have stopped using them entirely. You can read more about search engines in the w3schools.com Web Building Tutorial at:
The W3 Consortium states that Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URL. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects. For more information, visit the W3 Web site:

http://www.w3.org/TR/html4/struct/global.html#adef-http-equiv

N OTE

Uniform Resource Locator (URL)


Something called a uniform resource locator (URL) is used to address a document (or other data) on the World Wide Web. When you click on a link in an HTML document, an underlying <a> tag points to a place (an address) on the Web with an

href attribute value like this: <a href="lastpage.htm">Last Page</a>

The lastpage.htm link in the example is a link that is relative to the Web site that you are browsing, and your browser will construct a full Web address to access the page, such as: The scheme is defining the type of Internet service. The most common type is http. The domain is defining the Internet domain name like w3schools.com. The host is defining the domain host. If omitted, the default host for http is www. The :port is defining the port number at the host. The port number is normally omitted. The default port number for http is 80. The path is defining a path (a subdirectory) at the server. If the path is omitted, the resource (the document) must be located at the root directory of the Web site. The filename is defining the name of a document. The default filename might be default.asp, index.html, or something else depending on the settings of the Web server.

Insert a Script into a Page


Add scripts to HTML pages to make them more dynamic and interactive. A script in HTML is defined with the <script> tag. This example demonstrates how to insert a script into your HTML document. Note that you will have to use the type attribute to specify the scripting language. The following script produces the output shown in Figure 24.1.

How to Handle Older Browsers


A browser that does not recognize the <script> tag at all will display the <script> tags content as text on the page. To prevent the browser from doing this, you should hide the script in comment tags. An old browser (that does not recognize the <script> tag) will ignore the comment, and it will not write the tags content on the page. On the other hand, a new browser will understand that the script should be executed, even if it is surrounded by comment tags.

noscript Tag
In addition to hiding the script inside a comment, you can also add a <noscript> tag. The <noscript> tag is used to define an alternate text if a script is NOT executed. This tag is used for browsers that recognize the <script> tag, but do not support the script inside, so these browsers will display the text inside the <noscript> tag instead. However, if a browser supports the script inside the <script> tag it will ignore the <noscript> tag.

In This Chapter
Core Attributes Language Attributes Keyboard Attributes HTML tags can have attributes. The special attributes for each tag are listed under each tag description. The attributes listed here are the core and language attributes

that are standard for all tags (with a few exceptions).

You might also like