HTML script Element
The <script> tag is used to define a client-side script, such as a JavaScript and JQuery. The script element either contains scripting statements or it points to an external script file through the src attribute. The required type attribute specifies the MIME type of the script. Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
For Example
<script type="text/javascript">
document.write("Hello!")
</script>
The script above writes Hello! to the HTML output.
HTML noscript Element
The <noscript> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn’t 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 user’s browser:
For example
<script type="text/javascript">
document.write("Hello!")
</script>
<noscript>This is not inside Script!</noscript>
HTML Script Tags
Tag Description
<script> Defines a client-side script
<noscript> Defines an alternate content for users that do not support client-side scripts
HTML Advanced tutorial 23 : HTML Entities >>
<< HTML Advanced tutorial 21 : HTML Meta
Programming Tutorials on XHTML, CSS, JavaScript, JQuery, JSON, Python, Django, Amazon Web Services, ASP.NET, Web Forms, and SQL
Friday, April 27, 2012
HTML Advanced tutorial 21 : HTML Meta
Metadata is information about data. The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.
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.
Keywords for Search Engines
Some search engines will use the name and content attributes of the meta element to index your pages. The following meta element defines a description of a page:
<meta name="description" content="Free Web tutorials on HTML" />
The following meta element defines keywords for a page.
<meta name="keywords" content="HTML, CSS, XML" />
The intention of the name and content attributes is to describe the content of a page.
HTML Advanced tutorial 22 : HTML Scripts >>
<< HTML Advanced tutorial 20 : HTML head Elements
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.
Keywords for Search Engines
Some search engines will use the name and content attributes of the meta element to index your pages. The following meta element defines a description of a page:
<meta name="description" content="Free Web tutorials on HTML" />
The following meta element defines keywords for a page.
<meta name="keywords" content="HTML, CSS, XML" />
The intention of the name and content attributes is to describe the content of a page.
HTML Advanced tutorial 22 : HTML Scripts >>
<< HTML Advanced tutorial 20 : HTML head Elements
Friday, April 20, 2012
HTML Advanced tutorial 20 : HTML head Elements
The head element is a container for all the head elements. Elements inside <head> can include scripts, instruct the browser where to find style sheets, provide meta information, and more. The following tags can be added to the head section
<title>, <base>, <link>, <meta>, <script>, and <style>.
title Element
The <title> tag defines the title of the document. The title element is required in all HTML/XHTML documents. The title element
1). defines a title in the browser toolbar
2). provides a title for the page when it is added to favorites
3). displays a title for the page in search-engine results
For example,below is simplified HTML document.
<html>
<head>
<title>Title Here</title>
</head>
<body>
content Here.
</body>
</html>
base Element
The <base> tag specifies a default address or a default target for all links on a page. For example
<head>
<base href="http://www.yoursite.com/images/" />
<base target="_blank" />
</head>
link Element
The <link> tag defines the relationship between a document and an external resource. The <link> tag is most used to link to style sheets. For example
<head>
<link rel="stylesheet" type="text/css" href="mystylefile.css" />
</head>
style Element
The <style> tag is used to define style information for an HTML document.Inside the style element you specify how HTML elements should render in a browser:
<head>
<style type="text/css">
body {background-color:yellow}
p {color:blue}
</style>
</head>
The <meta> tag provides metadata about the HTML document.
The <script> tag is used to define a client-side script, such as a JavaScript.
HTML head Elements
Tag Description
<head> Defines information about the document
<title> Defines the title of a document
<base /> Defines a default address or a default target for all links on a page
<link /> Defines the relationship between a document and an external resource
<meta /> Defines metadata about an HTML document
<script> Defines a client-side script
<style> Defines style information for a document
HTML Advanced tutorial 21 : HTML Meta >>
<< HTML Advanced tutorial 19 : HTML Styles
<title>, <base>, <link>, <meta>, <script>, and <style>.
title Element
The <title> tag defines the title of the document. The title element is required in all HTML/XHTML documents. The title element
1). defines a title in the browser toolbar
2). provides a title for the page when it is added to favorites
3). displays a title for the page in search-engine results
For example,below is simplified HTML document.
<html>
<head>
<title>Title Here</title>
</head>
<body>
content Here.
</body>
</html>
base Element
The <base> tag specifies a default address or a default target for all links on a page. For example
<head>
<base href="http://www.yoursite.com/images/" />
<base target="_blank" />
</head>
link Element
The <link> tag defines the relationship between a document and an external resource. The <link> tag is most used to link to style sheets. For example
<head>
<link rel="stylesheet" type="text/css" href="mystylefile.css" />
</head>
style Element
The <style> tag is used to define style information for an HTML document.Inside the style element you specify how HTML elements should render in a browser:
<head>
<style type="text/css">
body {background-color:yellow}
p {color:blue}
</style>
</head>
The <meta> tag provides metadata about the HTML document.
The <script> tag is used to define a client-side script, such as a JavaScript.
HTML head Elements
Tag Description
<head> Defines information about the document
<title> Defines the title of a document
<base /> Defines a default address or a default target for all links on a page
<link /> Defines the relationship between a document and an external resource
<meta /> Defines metadata about an HTML document
<script> Defines a client-side script
<style> Defines style information for a document
HTML Advanced tutorial 21 : HTML Meta >>
<< HTML Advanced tutorial 19 : HTML Styles
Wednesday, April 18, 2012
HTML Advanced tutorial 19 : HTML Styles
When a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet.
External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the <head> section:
<head>
<link rel="stylesheet" type="text/css" href="file.css" />
</head>
Internal Style Sheet
An internal style sheet can be used if one single document has a unique style. Internal styles are defined in the <head> section of an HTML page, by using the <style> tag, like this.
<head>
<style type="text/css">
body {background-color:black;}
p {color:red;}
</style>
</head>
Inline Styles
An inline style can be used if a unique style is to be applied to one single occurrence of an element. To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property. For example.
<p style="color:red;margin-left:10px;">some paragraph.</p>
HTML Style Tags
Tag Description
<style> Defines style information for a document
<link /> Defines the relationship between a document and an external resource
HTML Advanced tutorial 20 : HTML head Elements >>
<< HTML Advanced tutorial 18 : HTML Doctypes
- External style sheet
- Internal style sheet
- Inline styles
External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the <head> section:
<head>
<link rel="stylesheet" type="text/css" href="file.css" />
</head>
Internal Style Sheet
An internal style sheet can be used if one single document has a unique style. Internal styles are defined in the <head> section of an HTML page, by using the <style> tag, like this.
<head>
<style type="text/css">
body {background-color:black;}
p {color:red;}
</style>
</head>
Inline Styles
An inline style can be used if a unique style is to be applied to one single occurrence of an element. To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property. For example.
<p style="color:red;margin-left:10px;">some paragraph.</p>
HTML Style Tags
Tag Description
<style> Defines style information for a document
<link /> Defines the relationship between a document and an external resource
HTML Advanced tutorial 20 : HTML head Elements >>
<< HTML Advanced tutorial 18 : HTML Doctypes
HTML Advanced tutorial 18 : HTML Doctypes
A doctype declaration refers to the rules for the markup language, so that the browsers render the content correctly. For example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
The content of Page here.
</body>
</html>
The above HTML document contains doctype of HTML 4.01 Transitional:
Different Doctypes
The doctype declaration is not an HTML tag, it is an instruction to the web browser about what version of the markup language the page is written in. The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly. The doctype declaration should be the very first thing in an HTML document, before the <html> tag. Always add a doctype to your pages. This helps the browsers to render the page correctly!
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements e.g font and center etc. Framesets are not allowed in this Doctype. For example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements e.g font etc. Framesets are not allowed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
This DTD is equal to HTML 4.01 Transitional, but allows the use of frameset content.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
HTML DOCTYPE Element
Tag Description
<!DOCTYPE> Defines the document type. This declaration goes before the <html> start tag
HTML Advanced tutorial 19 : HTML Styles >>
<< HTML Advanced tutorial 17 : HTML Layouts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
The content of Page here.
</body>
</html>
The above HTML document contains doctype of HTML 4.01 Transitional:
Different Doctypes
The doctype declaration is not an HTML tag, it is an instruction to the web browser about what version of the markup language the page is written in. The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly. The doctype declaration should be the very first thing in an HTML document, before the <html> tag. Always add a doctype to your pages. This helps the browsers to render the page correctly!
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements e.g font and center etc. Framesets are not allowed in this Doctype. For example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements e.g font etc. Framesets are not allowed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
This DTD is equal to HTML 4.01 Transitional, but allows the use of frameset content.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
HTML DOCTYPE Element
Tag Description
<!DOCTYPE> Defines the document type. This declaration goes before the <html> start tag
HTML Advanced tutorial 19 : HTML Styles >>
<< HTML Advanced tutorial 17 : HTML Layouts
Subscribe to:
Posts (Atom)