Saturday 29 November 2014

HTML Head and Body

The <head> tag and the <body> tag arethe two important tags used in HTML document. Both of them are essential in creating an HTML document.

HTML <head> Tag

The head element is a container for all head contents. Elements inside the <head> can include scripts, styles, title of the document, metadata, and more.
The following elements can go inside the head section :
HTML <title> Tag
The HTML <title> tag defines the title of the webpage. The title element is essential in an HTML document.

For example:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document..</title>
</li>
</ul>
<body>
Body of the document...
</body>
</html>
HTML <style> Tag
The HTML <style> tag is used to include styles for an HTML document.

Attributes
media media_query Specifies what media/device the media resource is optimized for
scoped scoped Specifies that the styles only apply to this element's parent element
and that element's child elements
type text/css Specifies the MIME type of the style sheet
For example:
<head>
<style type="text/css">
body { background-color:red }
p { color:yellow}
</style>
</head>
HTML <base> Tag
The <base> tag specifies a default address or a default target for all the links in the page.

Attributes
href URL Specifies the base URL for all relative URLs in the page
target _blank
_parent
_self
_top
framename
Specifies the default target for all hyperlinks and forms in the page
For example:
<head>
<base href="http://www.facebook.com/images"></base>
<base target="_blank"></base>
</head>
HTML <link> Tag
The <link> tag defines the relationship between a HTML document and an external source. It is commonly used to link style sheets.

Attributes
charset char_encoding Specifies the character encoding of the linked document
href URL Specifies the location of the linked document
hreflang language_code Specifies the language of the text in the linked document
media media_query Specifies on what device the linked document will be displayed
rel alternate
archives
author
bookmark
external
first
help
icon
last
license
next
nofollow
noreferrer
pingback
prefetch
prev
search
sidebar
stylesheet
tag
up
Required. Specifies the relationship between the current
document and the linked document
rev reversed relationship Specifies the relationship between the linked document
and the current document
sizes HeightxWidth
any
Specifies the size of the linked resource. Only for rel="icon"
target _blank
_self
_top
_parent
frame_name
Specifies where the linked document is to be loaded
type MIME_type Specifies the MIME type of the linked document
For example:
<head>
<link href="styles.css" rel="stylesheet" type="text/css"></link>
</head>
HTML <meta> Tag
The <meta> tag provide the metadata about the HTML document. It will be displayed on the page, but will be machine readable. Meta elements are usually used to specify the description, keywords, author of the document etc.

Attributes
charset character_set Specifies the character encoding for the HTML document
content content Gives the value associated with the http-equiv or name attribute
http-equiv content-type
default-style
refresh
Provides an HTTP header for the information/value of the content
attribute
name application-name
author
description
generator
keywords
Specifies a name for the metadata
scheme format/URI Specifies a scheme to be used to interpret the value of the
content attribute
For example:
<head>
<meta charset="UTF-8">
<meta name="description" content="HTML tutorials">
<meta name="keywords" content="HTML, CSS, Bootstrap">
<meta name="author" content="Edwin Ronald Lambert">
</head>
HTML <script>Tag
The <script> tag is used to define a client-side script, such as JavaScript. The script element usually contains scripting statements or an external file that contains the scripting statements.

Attributes
async async Specifies that the script is executed asynchronously (only for external
scripts)
charset charset Specifies the character encoding used in an external script file
defer defer Specifies that the script is executed when the page has finished parsing
(only for external scripts)
src URL Specifies the URL of an external script file
type MIME-type Specifies the MIME type of the script
xml:space preserve Specifies whether whitespace in code should be preserved

For example:
<head>
<script type="text/javascript">
document.write
("Hello World!")
</script>
</head>
HTML <noscript> Tag
The <noscript> tag is used to provide an alternate content for users who have disabled scripts in their browsers.

For example:
<head>
<script type="text/javascript">
document.write
("Hello World!")
</script>
<noscript>Sorry, your browser does not support JavaScript.<br /></noscript>

HTML <body> Tag

The <body> tag contains all the content visible in the HTML webpage. It can contain text, hyperlinks, pictures, tables, forms etc. In fact, all the page content is written inside the body element. That is why, the body element is one of the most important elements in HTML language.

Wednesday 26 November 2014

Introduction to CSS

CSS is used to control the style and layout of multiple web pages. It defines how to style HTML elements. An HTML element can be displayed with different styles using CSS.

CSS stands for Cascading Style Sheets.

CSS language are normally saved as external .css file. External style sheets helps you to change the appearance and layout of al the webpages using a single file. Therefore, using a CSS file can save you a lot of work and design the webpage as you like.

CSS Syntax

A CSS declaration always ends in a semi-colon and the group is surrounded by curly brackets. A CSS rule consist of a selector and the declaration block:

For example:
h1 {color:blue;}
In this example, "h1" is the selector. The selector points out the HTML element you want to style.The selector is used to select a specific tag in which the style is to be applied on and edit the element according to our wish. CSS selectors are used to find or select the HTML element based on their id, classes, types, attributes, values of attributes etc.

Everything inside the curly bracket is called the declaration. The declaration block can contain more than one or more declarations separated by a comma. Each declaration contains a property name and values, which is separated by a comma. In this example, the property name is "color" and the value is "blue". It specifies the color of the h1 heading to be blue in color.

CSS Comments

Comments are used to explain the code or what that HTML element is used for. It is very useful for users to edit the source code later. Comments are ignored by the browser, so that they are not displayed in the web browser.

CSS comments starts with /* and ends with */. Comments are plain text written inside /* and */. Comments can also span multiple lines

For example:
/*This is a single line comment*/
h1 {color:blue;
/*This is a 
multiple line comment*/
}

CSS Style Sheets

CSS style sheets can be added in three ways:

  1. External Style Sheets
  2. Internal Style Sheets
  3. Inline Style Sheets
External Style Sheets: An external style sheets is used when the same style is used to more than one webpage. With an external style sheet, we can change the looks of the entire webpage by changing just one file. Each page must be linked to the style sheet using the tag. The tag goes inside the head section.

For example:
<head>
<link href="style.css" rel="stylesheet" type="text/css"></link>
</head>
An external CSS style sheet can be written in Notepad just like HTML, but should be saved with .css extension.

For example:
h1 {color:blue;}
p{color:red;}
Internal Style Sheets: An internal style sheet should be used when a single document should have a unique style. We can define internal style sheet in the head section of the HTML page,using the &ltstyle> tag.

For example:
<head>
<style>
h1 {color:blue;}
p{color:red;}
</style>
<head>
Inline Style Sheets: An inline style sheet is used when a single element should be given a unique style. Inline styles are given inside the tag itself as attributes. To use the inline style, we should use the style attribute in that particular tag. The style is possible to contain any CSS styles but that property is only restricted to that particular element only.

For example:
<div style="color: red;">
This is a paragraph.</div>

Saturday 22 November 2014

HTML Know The Basics

HTML language have a pattern in which the content is edited. Everyone who codes in HTML language should follow the same principle provided by the HTML standards. HTML language consists of different sections in which each section is coded.

Here is a sample code written in HTML

<html>

<head>
Head of the document...
</head>

<body>
Body of the document...
</body>

</html>

HTML Versions

Since the beginning of the web, there have been many versions of HTML, each one of them better than the previous with more functions and efficiency.

  1. HTML - Released in 1991
  2. HTML+ - Released in 1993
  3. HTML 2.0 - Released in 1995
  4. HTML 3.2 - Released in 1997
  5. HTML 4.01 - Released in 1999
  6. XHTML 1.0 - Released in 2000
  7. HTML5 - Released in 2012

HTML Declaration

The Declaration is the first thing to be coded in your HTML page. It defined the document type of the HTML page that you are coding. It is also prompted to add the declaration to your HTML page, so that the browser can determine what type of document the webpage is.

The Declaration is not an HTML tag, it is just used to instruct the web browser about the version of HTML used to code the webpage.

in HTML 4.01, the declaration refers to DTD, because HTML 4.01 was based on SGML. The DTD is used to specify the rules for the markup language, so that the browser can render the contents correctly. In HTML5 it does not require a reference to a DTD because it is not based on SGML. Here are some of the common DOCTYPE Declaration of HTML

HTML5
<!DOCTYPE html>
HTML 4.01 Strict
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

HTML <html> Tag

The <html> tag is used to describe the webpage. It is used to tell the browser that this is an HTML document.

The <html> tag is the root of an HTML document and is also the container for all other HTML elements except the declaration.

HTML <head> Tag

The <head> element is used to include the header files of the webpage. It is a container for all head elements.

The following elements can go inside the head section :

  • <title>
  • <style>
  • <base>
  • <link>
  • <meta>
  • <script>
  • <noscript>

HTML <body> tag

The <body> tag is used to define the document's body. It is used to describe the visible webpage contents coded using HTML language.

The <body> tag contains all the contents of an HTML document, such as text, hyperlinks, images, tables, forms etc.

HTML Comments

Comments are used to place details and information about HTML elements. comments are not displayed by the browser but is visible in the source code. Comments are used using the comment tag <!-- and -->. Note that an exclamation mark (!) is written in the starting but not in the ending.

For example:
<!--This is a comment-->

Monday 17 November 2014

HTML5

HTML5 is the latest version of HTML language. HTML5 was created to replace HTML 4, XHTML, and the HTML DOM Level 2. It is the fifth standard of the HTML standard.

HTML5 is developed by the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG). Before creating HTML5, WHATWG was working with web forms and applications and on the other hand. W3C was developing the XHTML 2.0. After that in 2006, they decided to cooperate and develop a new version of HTML.

Today, several elements in HTML 4.01 are obsolete, they are never used. So, in HTML5, these elements are removed or are re-written for better functioning. It is specially designed to improve the language with support to multimedia and deliver rich contents without the use of additional plugins. It is easily understood by human beings as well as computers and other devices. The current version delivers everything such as animation, graphics, musics and movies and is also used to create complicated web applications.

For better handling of today's internet, HTML5 is also included with new elements for drawing 2D graphics, displaying media, creating a better page structure and better form, and several new APIs, such as drag and drop, get the geographical position of a auser, store local data and more.
HTML5 is a cross-platform. It is very useful and helps to work whether we are using PC, or a Tablet, or a Smartphone.

Some of the new interesting features of HTML5 are:
  • The <canvas> tag is used to draw 2D drawing.
  • The <audio> and <video> tags are used for adding media on the webpage without the use of any additional plugin.
  • HTML5 has support for local storage.
  • Introduction of new content-specific elements such as <article>, <header>, <footer>, <nav> etc.
  • New form controls like calender, date, time, email, url, search.
Here is a simple HTML5 document.

<!DOCTYPE html>
<html>

<head>

<title>Title of the document...</title>
</head>

<body>
Body of the document...
</body>

</html>

Sunday 16 November 2014

What is HTML?

HTML is a most commonly used language for designing websites. Today HTML language is being taught at young age onwards. This language is user-friendly and efficient to use. It is very interesting and easy to learn.

HTML stands for Hyper Text Markup Language.

HTML language consist of a set of rules as to govern how the website looks. These set of rules is called as Tags. An HTML tag is used to format and describes the content of the document in HTML. HTML language is a collection of tags and contents.

HTML language is a subset of Standard Generalized Markup Language (SGML) and is maintained and specified by the World Wide Web Consortium (W3C).

HTML Tags

HTML tags are instructions that are embedded directly into the text of an HTML document. HTML tags are contained inside a pair of angle brackets. For example: <html>. HTML tags are keywords that point out a specific function to perform in HTML language. For example: html tag (<html>) specifies that the document we are writing is an HTML code. image tag (<img />) specifies the image location and hyprlink (<a href="https://www.blogger.com/null">) specifies the desired location in an HTML document.

There are two types of tags
  1. Container Tags
  2. Empty Tags
Container Tags
HTML container tags are specified in pairs, delimiting text that will have some type of formatting like and . The first tag is called the opening tag and the second tag is called the closing tag. The ending tag is written like the starting tag but contains a forward slash (/) before the tag name.

Empty Tags 
HTML empty tag is a single tag, representing some formatting command in HTML. For example: <br >

HTML Elements

HTML document are defined by HTML elements. HTML elements contains everything from the opening tag to the closing tag. It includes the tagname and also the content between them. Some of the HTML elements have empty contents and these elements are closed in the opening tag itself.

HTML Attributes

HTML attributes are used to provide additional information about HTML elements. They are very useful in coding a webpage.

Attributes are always specified in the opening tag. Attributes are defined to the tagname and come in name/value pairs like name="value". Attributes values should always be enclosed in double quotes.

Attribute names and attribute values are case-sensitive that is they can be coded in uppercase character or lowercase character. However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in HTML.

Writing an HTML code

HTML code is easy to learn and fun to write. We don't have to buy software for writing an HTML code. Simple text editors like Notepad (PC) and TextEdit (Mac) can be used to write a HTML code.

  1. To write a HTML code, first open Notepad,
    To open Notepad go to: Start - Programs - Accessories - Notepad.
  2. Type a HTML code in Notepad.
    <html>
    <head>
    header files goes here....
    </head>
    <body>
    body files goes here....
    </body>
    </html>
    
  3. Next save your HTML code as html file. For that, click File - Save as. When you save your document save it with .htm or .html extension.
  4. After you save your HTML file, open it in any web browser available in your computer. The resulted design you see is the HTML code translated into web pages.