INTRODUCTION
TO HTML
HTML is the standard markup language for
creating Web pages.
- HTML stands for Hyper Text Markup Language
- HTML describes the structure of Web pages using markup
- HTML elements are the building blocks of HTML pages
- HTML elements are represented by tags
- HTML tags label pieces of content such as "heading", "paragraph", "table", and so on
- Browsers do not display the HTML tags, but use them to render the content of the page
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Common HTML Terms:
·
Tags
·
Attributes
·
Elements
Tags:-
Tag
|
Description
|
Defines a comment
|
|
Defines the document type
|
|
Defines a hyperlink
|
|
Defines an abbreviation
or an acronym
|
|
Defines contact
information for the author/owner of a document
|
|
Defines an area inside an
image-map
|
|
Defines an article
|
|
Defines content aside
from the page content
|
|
Defines sound content
|
|
Defines bold text
|
|
Specifies the base
URL/target for all relative URLs in a document
|
|
Defines a section that is
quoted from another source
|
|
Defines the document's
body
|
|
Defines a single line
break
|
|
Defines a clickable
button
|
|
Used to draw graphics, on
the fly, via scripting (usually JavaScript)
|
|
Defines a table caption
|
|
Defines a piece of
computer code
|
|
Specifies column
properties for each column within a <colgroup> element
|
|
Specifies a list of
pre-defined options for input controls
|
|
Defines a
description/value of a term in a description list
|
|
Defines text that has
been deleted from a document
|
|
Defines additional
details that the user can view or hide
|
|
Defines a dialog box or
window
|
|
Defines a section in a
document
|
|
Defines a description
list
|
|
Defines a term/name in a
description list
|
|
Defines emphasized
text
|
|
Defines a container for
an external (non-HTML) application
|
|
Groups related elements
in a form
|
|
Defines a caption for a
<figure> element
|
|
Specifies self-contained
content
|
|
Not
supported in HTML5. Use CSS instead.
Defines font, color, and size for text |
|
Defines a footer for a
document or section
|
|
Defines an HTML form for
user input
|
|
Not
supported in HTML5.
Defines a window (a frame) in a frameset |
|
Not
supported in HTML5.
Defines a set of frames |
|
Defines HTML headings
|
|
Defines information about
the document
|
|
Defines a header for a
document or section
|
|
Defines a thematic change
in the content
|
|
Defines the root of an
HTML document
|
|
Defines a part of text in
an alternate voice or mood
|
|
Defines an inline frame
|
|
Defines an image
|
|
Defines an input control
|
|
Defines a text that has
been inserted into a document
|
|
Defines keyboard input
|
|
Defines a key-pair
generator field (for forms)
|
|
Defines a label for
an <input> element
|
|
Defines a caption for a
<fieldset> element
|
|
Defines a list item
|
|
Defines the relationship
between a document and an external resource (most used to link to style
sheets)
|
|
Specifies the main
content of a document
|
|
Defines a client-side
image-map
|
|
Defines
marked/highlighted text
|
|
Defines a list/menu of
commands
|
|
Defines a command/menu
item that the user can invoke from a popup menu
|
|
Defines metadata about an
HTML document
|
|
Defines a scalar
measurement within a known range (a gauge)
|
|
Defines navigation links
|
|
Not
supported in HTML5.
Defines an alternate content for users that do not support frames |
|
Defines an alternate content
for users that do not support client-side scripts
|
|
Defines an embedded
object
|
|
Defines an ordered list
|
|
Defines a group of
related options in a drop-down list
|
|
Defines an option in a
drop-down list
|
|
Defines the result of a
calculation
|
|
Defines a paragraph
|
|
Defines a parameter for
an object
|
|
Defines a container for
multiple image resources
|
|
Defines preformatted text
|
|
Represents the progress
of a task
|
|
Defines a short quotation
|
|
Defines what to show in
browsers that do not support ruby annotations
|
|
Defines an
explanation/pronunciation of characters (for East Asian typography)
|
|
Defines a ruby annotation
(for East Asian typography)
|
|
Defines text that is no
longer correct
|
|
Defines sample output
from a computer program
|
|
Defines a client-side
script
|
|
Defines a section in a
document
|
|
Defines a drop-down list
|
|
Defines smaller text
|
|
Defines multiple media
resources for media elements (<video> and <audio>)
|
|
Defines a section in a
document
|
|
Not
supported in HTML5. Use <del> or <s> instead.
Defines strikethrough text |
|
Defines important text
|
|
Defines style information
for a document
|
|
Defines subscripted text
|
|
Defines a visible heading
for a <details> element
|
|
Defines superscripted
text
|
|
Defines a table
|
|
Groups the body content
in a table
|
|
Defines a cell in a table
|
|
Defines a multiline input
control (text area)
|
|
Groups the footer content
in a table
|
|
Defines a header cell in
a table
|
|
Groups the header content
in a table
|
|
Defines a date/time
|
|
Defines a title for the
document
|
|
Defines a row in a table
|
|
Not
supported in HTML5. Use CSS instead.
Defines teletype text |
|
Defines text that should
be stylistically different from normal text
|
Attributes:
Attributes provide additional information about
HTML elements.
HTML Attributes
Ø All HTML
elements can have attributes
Ø Attributes
provide additional
information about an
element
Ø Attributes
are always specified in the start
tag
Ø Attributes
usually come in name/value pairs like: name="value"
Attribute
|
Description
|
alt
|
Specifies an alternative
text for an image, when the image cannot be displayed
|
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 Elements
An HTML element usually consists of a start tag and end tag, with the content
inserted in between:
<tagname>Content goes here...</tagname>
The HTML element is
everything from the start tag to the end tag:
<p>My first paragraph.</p>
Start tag
|
Element content
|
End tag
|
<h1>
|
My First Heading
|
</h1>
|
<p>
|
My first paragraph.
|
</p>
|
<br>
|
HTML elements with no content are called empty elements. Empty
elements do not have an end tag, such as the <br> element (which
indicates a line break).
Nested HTML Elements
HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
This example contains four HTML elements:
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</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>
<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>
<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>
FUNDAMENTAL TAGS:
Tag
|
Description
|
Defines the document type
|
|
Defines an HTML document
|
|
Defines a title for the
document
|
|
Defines the document's
body
|
|
Defines HTML headings
|
|
Defines a paragraph
|
|
Inserts a single line
break
|
TABLE:-
An HTML table is defined with the <table> tag.
Each table row is defined with the <tr> tag. A table header is defined with the <th> tag. By default, table headings are bold
and centered. A table data/cell is defined with the <td> tag.
Example
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Lists
HTML List Example
An Unordered List:
- Item
- Item
- Item
- Item
An Ordered List:
- First item
- Second item
- Third item
- Fourth item
Unordered HTML List
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small black circles)
by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Ordered HTML List
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
The list items will be marked with numbers by default:
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
LINKS:
Links are found in nearly all web pages. Links
allow users to click their way from page to page.
HTML Links - Hyperlinks
HTML links are hyperlinks.
You can click on a link and jump to another
document.
When you move the mouse over a link, the mouse
arrow will turn into a little hand.
HTML Links - Syntax
In HTML, links are defined with the <a> tag:
<a href="url">link text</a>
Local Links
The example above used an absolute URL (A full web address).
A local link (link to the same web site) is specified with a relative
URL (without http://www....).
HTML Link Colors
By default, a link will appear like this (in all browsers):
- An unvisited link is underlined and blue
- A visited link is underlined and purple
- An active link is underlined and red
You can change the default colors, by using styles:
Example
<style>
a:link {color:green; background-color:transparent; text-decoration:none}
a:visited {color:pink; background-color:transparent; text-decoration:none}
a:hover {color:red; background-color:transparent; text-decoration:underline}
a:active {color:yellow; background-color:transparent; text-decoration:underline}
</style>
a:link {color:green; background-color:transparent; text-decoration:none}
a:visited {color:pink; background-color:transparent; text-decoration:none}
a:hover {color:red; background-color:transparent; text-decoration:underline}
a:active {color:yellow; background-color:transparent; text-decoration:underline}
</style>
FORMS:-
HTML Forms are required when you want to collect some data from
the site visitor. For example during user registration you would like to
collect information such as name, email address, credit card, etc.
HTML Form Controls
There are different types of form controls that you can use to
collect data using HTML form:
·
Text Input Controls
·
Checkboxes Controls
·
Radio Box Controls
·
Select Box Controls
·
File Select boxes
·
Hidden Controls
·
Clickable Buttons
·
Submit and Reset Button
EXAMPLE:-
<html>
|
|
<head>
|
|
</head>
|
|
<body><center>
|
|
<h2>Connect us:</h2>
|
|
<table>
|
|
<form>
|
|
Please only write in english we
are sorry we can't read any other language.
|
|
<br><br>
|
|
Your name:<input
type="text" name="Name"><br><br>
|
|
Your email:<input
type="text" name="email"><br>
|
|
Massage:<br>
|
|
<textarea cols="100"
rows="10"></textarea><br><br>
|
|
<input type="button"
onclick="alert('Massage sent.....')" value="Send
Massage"/>
|
|
</form>
|
|
</table></center>
|
|
</body>
|
|
Comments
Post a Comment