Pages

Thursday 31 December 2015

the title attribute

The title Attribute

HTML paragraphs are defined with the <p> tag.
In this example, the <p> element has a title attribute. The value of the attribute is "About mad2html":

Example

<p title="About mad2html">
mad2html is a web developer's site.
It provides tutorials and references covering
many aspects of web programming, including HTML,
 </p>
Note When you move the mouse over the element, the title will be displayed as a tooltip

The lang Attribute

The lang Attribute

The document language can be declared in the <html> tag.
The language is declared in the lang attribute.
Declaring a language is important for accessibility applications (screen readers) and search engines:
<!DOCTYPE html>
<html lang="en-US">
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
The first two letters specify the language (en). If there is a dialect, use two more letters (US).

HTML Attributes

HTML Attributes

  • HTML elements can have attributes
  • Attributes provide additional information about an element
  • Attributes are always specified in the start tag
  • Attributes come in name/value pairs like: name="value"




Below is an alphabetical list of some attributes often used in HTML:

Attribute Description
alt Specifies an alternative text for an image
disabled Specifies that an input element should be disabled
href Specifies the URL (web address) for a link
id Specifies a unique id for an element
src Specifies the URL (web address) for an image
style Specifies an inline CSS style for an element
title Specifies extra information about an element (displayed as a tool tip)
 

HTML Example Explained

HTML Example Explained

The <html> element defines the whole document.
It has a start tag <html> and an end tag </html>.
The element content is another HTML element (the <body> element).

<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
 
The <body> element defines the document body.
It has a start tag <body> and an end tag </body>.
The element content is two other HTML elements (<h1> and <p>).
 
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
 
The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>.
The element content is: My First Heading.
<h1>My First Heading</h1>
The <p> element defines a paragraph.
It has a start tag <p> and an end tag </p>.
The element content is: My first paragraph.
<p>My first paragraph.</p>

Don't Forget the End Tag

Some HTML elements will display correctly, even if you forget the end tag:

Example

<html>
<body>

<p>This is a paragraph
<p>This is a paragraph

</body>
</html>
The example above works in all browsers, because the closing tag is considered optional.
Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

Empty HTML Elements

HTML elements with no content are called empty elements.
<br> is an empty element without a closing tag (the <br> tag defines a line break).
Empty elements can be "closed" in the opening tag like this: <br />.
HTML5 does not require empty elements to be closed. But if you want stricter validation, or you need to make your document readable by XML parsers, you should close all HTML elements.

HTML Tip: Use Lowercase Tags

HTML tags are not case sensitive: <P> means the same as <p>.
The HTML5 standard does not require lowercase tags, but we recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.

Nested HTML Elements

Nested HTML Elements

HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
This example contains 4 HTML elements:

Example

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

HTML Elements

HTML Elements

HTML elements are written with a start tag, with an end tag, with the content in between:
<tagname>content</tagname>
The HTML element is everything from the start tag to the end tag:
<p>My first HTML paragraph.</p>
Start tag Element content End tag
       <h1> My First Heading          </h1>
       <p> My first paragraph.         </p>
       <br>    
Note Some HTML elements do not have an end tag.

HTML Images

HTML Images

HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), and size (width and height) are provided as attributes:

Example

<img src="mad2html.jpg" alt="mad2html.com" width="208" height="208">

HTML Links

HTML Links

HTML links are defined with the <a> tag:

Example

<a href="http://mad2html.blogspot.in/">This is a link</a>

The link's destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
 

HTML Paragraphs

HTML Paragraphs

HTML paragraphs are defined with the <p> tag:

Example

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

HTML Headings

HTML Headings

HTML headings are defined with the <h1> to <h6> tags:

Example

<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>

HTML Documents

HTML Documents

All HTML documents must start with a type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.

Example

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

Steps to write a HTML Program

 

Step 1: Open Notepad (PC)

Open Notepad in Windows 8 or later:
Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.
Open Notepad in Windows 7 or earlier:
Click Start (bottom left on your screen). Click All Programs. Click Accessories. Click Notepad.

Step 1: Open TextEdit (Mac)

 Open TextEdit.
Please be sure that the text editor is set to plain text. Go to: Preferences > New Document > select plain text.
Also make sure both "Display html file as html code" and "Display RTF file as RTF code" options are checked under "Open and Save".
Then open a new document to place the code.

Step 2: Write Some HTML

Write or copy some HTML into Notepad.
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>
Notepad

Step 3: Save the HTML Page

Save the file on your computer.
Select File > Save as in the Notepad menu.
Name the file "index.html" or any other name ending with html or htm.
UTF-8 is the preferred encoding for HTML files.
ANSI encoding covers US and Western European characters only.
View in Browser
Note You can use either .htm or .html as file extension. There is no difference, it is up to you.

Step 4: View HTML Page in Your Browser

Open the saved HTML file in your favorite browser. The result will look much like this:
View in Browser
Note To open a file in a browser, double click on the file, or right-click, and choose open with

HTML Editors

Write HTML Using Notepad or TextEdit

HTML can be edited by using professional HTML editors like:
  • Microsoft WebMatrix
  • Sublime Text
However, for learning HTML we recommend a text editor like Notepad (PC) or TextEdit (Mac).
We believe using a simple text editor is a good way to learn HTML.
Follow the 4 steps below to create your first web page with Notepad.

HTML Versions

HTML Versions

Since the early days of the web, there have been many versions of HTML:

Version      Year
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML5        2014

waht is Declaration

The <!DOCTYPE> Declaration

The <!DOCTYPE> declaration helps the browser to display a web page correctly.
There are different document types on the web.
To display a document correctly, the browser must know both type and version.
The doctype declaration is not case sensitive. All cases are acceptable:
<!DOCTYPE html>

<!DOCTYPE HTML>

<!doctype html>

<!Doctype Html>

Basic HTML Page Structure

HTML Page Structure

Below is a visualization of an HTML page structure:
<html>
<head>
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
Note Only the <body> area (the white area) is displayed by the browser.

How to display HTML code in Web Browsers

How to display HTML code in Web Browsers

The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them.
The browser does not display the HTML tags, but uses them to determine how to display the document:
View in Browser

HTML Tags

HTML Tags

HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
  • HTML tags normally come in pairs like <p> and </p>
  • The first tag in a pair is the start tag, the second tag is the end tag
  • The end tag is written like the start tag, but with a slash before the tag name
Note The start tag is often called the opening tag. The end tag is often called the closing tag.

sample HTML Example

HTML Example

A small HTML document:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

Example Explained

  • The DOCTYPE declaration defines the document type to be HTML
  • The text between <html> and </html> describes an HTML document
  • The text between <head> and </head> provides information about the document
  • The text between <title> and </title> provides a title for the document
  • The text between <body> and </body> describes the visible page content
  • The text between <h1> and </h1> describes a heading
  • The text between <p> and </p> describes a paragraph
Using this description, a web browser can display a document with a heading and a paragraph.

What is HTML?


What is HTML?

HTML is a markup language for describing web documents (web pages).
  • HTML stands for Hyper Text Markup Language
  • A markup language is a set of markup tags
  • HTML documents are described by HTML tags
  • Each HTML tag describes different document content

Thursday 26 November 2015

Ebooks

Ebooks

Sample Projects

Sample Projects

Scenarios

Scenarios

Interview Questions

Interview Questions

Certifications

Certifications

Installations

Installations

Requirements to start with HTML 5

Requirements

About The Blog


About The Blog

This blog gives the Complete information of HTML5, which consists of--

Tutorial-- Starts from Basics, any person can easily understood.
Interview Questions-- i try to upload various company FAQs
Scenarios -- for practice.
Sample Projects.-- for Understanding.
etc....