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

Head Section Tags

The document summarizes different HTML tags that can be added to the head section of a document: <base> specifies the base URL for relative URLs in the document. <meta> provides metadata about the document that is not displayed. <script> defines client-side scripts. <style> defines style rules for document elements. <noscript> provides alternate content if scripts are disabled. <link> defines the relationship between the document and external resources like style sheets.

Uploaded by

Habib Mangoli
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 DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views3 pages

Head Section Tags

The document summarizes different HTML tags that can be added to the head section of a document: <base> specifies the base URL for relative URLs in the document. <meta> provides metadata about the document that is not displayed. <script> defines client-side scripts. <style> defines style rules for document elements. <noscript> provides alternate content if scripts are disabled. <link> defines the relationship between the document and external resources like style sheets.

Uploaded by

Habib Mangoli
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 DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

The following tags can be added to the head section: <base>: The <base> tag specifies the base

URL/target for all relative URLs in a document. The <base> tag goes inside the <head> element. Attributes: Attribute Value Description href URL Specifies a base URL for all relative URLs on a page. Note: The base URL must be an absolute URL! target _blank Specifies the default target for all hyperlinks and _parent forms in the page. _self _top framenam e Example: <html> <head> <base href="http://www.w3schools.com/images/" target="_blank" /> </head> <body> <img src="stickman.gif" width="24" height="39" /> - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "http://www.w3schools.com/images/stickman.gif" <br /><br /> <a href="http://www.w3schools.com">W3Schools</a> - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank". </body> </html> OUTPUT: - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "http://www.w3schools.com/images/stickman.gif" W3Schools - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank". <meta>: Metadata is data (information) about data. The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page. Meta elements are typically used to specify page description, keywords, author of the document, last modified and other metadata. The <meta> tag always goes inside the <head> element. The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services. Example 1 - Define keywords for search engines: <meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript" /> Example 2 - Define a description of your web page: <meta name="description" content="Free Web tutorials on HTML and CSS" /> Example 3 - Define the last revision of your page: <meta name="revised" content="Hege Refsnes, 23/10/2011" /> Example 4 - Refresh document every 30 seconds:

<meta http-equiv="refresh" content="30" /> <script>: The <script> tag is used to define a client-side script, such as a JavaScript. Example: <html> <body> <script type="text/javascript"> document.write("Hello World!") </script> </body> </html> OUTPUT: Hello World!

<style>: The <style> tag is used to define style information for an HTML document. Inside the <style> element you specify how HTML elements should render (perform) in a browser. The required type attribute defines the content of the <style> element. The only possible value is "text/css". The <style> element always goes inside the head section. Example: <html> <head> <style type="text/css"> h1 {color:red;} p {color:blue;} body {background-color:yellow;} </style> </head> <body> <h1>Header 1</h1> <p>A paragraph.</p> </body> </html> <noscript>: The <noscript> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesnt support client-side scripting. The <noscript> element can contain all the elements that you can find inside the <body> element of a normal HTML page. The content inside the <noscript> element will only be displayed if scripts are not supported, or are disabled in the users browser. Example: <html> <body> <script type="text/javascript"> document.write("Hello World!") </script> <noscript>Sorry, your browser does not support JavaScript!</noscript> <p>A browser without support for JavaScript will show the text in the noscript element.</p> </body> </html> OUTPUT: Hello World!

A browser without support for JavaScript will show the text in the noscript element. <link>: The <link> tag defines the relationship between a document and an external resource. The <link> tag is most used to link to style sheets. This is the style sheet file (ex1.css): body { background-color:yellow; } h1 { font-size:36pt; } h2 { color:blue; } p { margin-left:50px; }

HTML File: <html> <head> <link rel="stylesheet" type="text/css" href="ex1.css" /> </head> <body> <h1>This header is 36 pt</h1> <h2>This header is blue</h2> <p>This paragraph has a left margin of 50 pixels</p> </body> </html>

You might also like