An HTML Element Is An Individual Component of An HTML Document
An HTML Element Is An Individual Component of An HTML Document
HTML, which stands for Hyper Text Markup Language, is the predominant
markup language for web pages. HTML is the basic building-blocks of
webpages. A markup language is a set of markup tags, and HTML uses markup
tags to describe web pages.
HTML elements form the building blocks of all websites. HTML allows images
and objects to be embedded and can be used to create interactive forms. It
provides a means to create structured documents by denoting structural
semantics for text such as headings, paragraphs, lists, links, quotes and other
items. It can embed scripts in languages such as JavaScript which affect the
behavior of HTML webpages.
HTML documents are composed entirely of HTML elements that, in their most
general form have three components: a pair of element tags, a "start tag" and
"end tag"; some element attributes within the start tag; and finally, any textual
and graphical content between the start and end tags. The HTML element is
everything between and including the tags. Each tag is enclosed in angle
brackets.
HTML ELEMENTS
An HTML element is an individual component of an HTML document. HTML
documents are composed of a tree of HTML elements and other nodes, such as
text nodes. Each element can have attributes specified. Elements can also have
content, including other elements and text. HTML elements represent
semantics, or meaning. For example, the title element represents the title of the
document.
In the HTML syntax, most elements are written with a start tag and an end tag,
with the content in between. Tags are composed of the name of the element,
surrounded by angle brackets. An end tag also has a slash after the opening
angle bracket, to distinguish it from the start tag Attributes are specified on the
start tag.
Element types
1. <html>...</html>
This tag identifies the document as an HTML document. This tag is
optional and even if it not written , most web browsers assumes its
existence. But it is good to include it in document. All other tags are
included within <HTML> and </HTML> tags. The Root element of an
HTML document; all other elements are contained in this.
The HTML element delimits the beginning and the end of an HTML
document.
2. <head>...</head>
This tag contains information about the document, including its title,
scripts used, style definitions and document descriptions. The portion
enclosed between <HEAD> and </HEAD> tags is called header. The
header of the document is where global setting are defined. Container for
processing information and metadata for an HTML document. Usually
the title should be included in the head, for example:
<head>
<title>The title</title>
</head>
Head elements
<base>
It Specifies a base URL for all relative href and other links in the
document. Must appear before any element that refers to an external
resource. HTML permits only one base element for each document.
<isindex>
isindex could either appear in the document head or in the body, but only
once in a document. Requires a server-side search engine.
<link>
<meta>
<object>…</object>
<script>…</script>
<style>…</style>
4. <body>...</body>
This tag encloses all tags, attributes and information that one wants the
browser to display. To use the tag , enter it below the closing </HEAD>
tag and above the closing </HTML> tag. It is the Container for the
displayable content of an HTML document.
Body elements
1) <p>…</p>
This tag is used to Create a paragraph, perhaps the most common block
level element.
These are the Section headings at different levels. <h1> delimits the
highest-level heading, <h2> the next level down (sub-section), <h3> for a
level below that, and so on to <h6>.
3) <br>
'br' breaks a line without altering the semantic structure of the page, 'br' is an
empty element in that, while it may have attributes, it can take no content or end
tag.
4) <center>…</center>
It Creates a block-level center-aligned division.
5) <b>…</b>
It Sets font to boldface where possible.
6) <i>…</i>
7) <big>…</big>
8) <small>…</small>
10) <u>…</u>
Underlines text.
11) <font>…</font>
It Can specify the font color with the color attribute, typeface with the
face attribute, and absolute or relative size with the size attribute.
Examples:
List attributes
A. <ol>…</ol>
B. <ul>…</ul>
C. <dir>…</dir>
A directory listing. The original purpose of this element was never widely
supported; deprecated in favor of <ul>.
D. <menu>…</menu>
A menu listing. Should be more compact than an <ul> list, but badly
supported. Deprecated in favor of <ul>.
Example <ul>
<li>ol - ordered list</li>
<li>ul - unordered list</li>
<li>dir - directory list (deprecated)</li>
<li>menu - menu list (deprecated)</li>
</ul>
List programming
I. DIRECTORY LIST
coding results
List Name
<DIR> List Name
<LI>List item 1 List item 1
<LI>List item 2 List item 2
</DIR>
coding results
Preceeding Text Preceeding Text
<OL> List Header
<:LH>List Header</LH>
<LI>List item 1 1. List item 1
<LI>List item 2
</OL> 2. List item 2
coding results
Preceeding Text Preceeding Text
<UL> List Header
<LH>List Header</LH>
<LI>List item 1 • List item 1
<LI>List item 2
</UL> • List item 2
IMAGE
The HTML img tag is used for embedding images into an HTML document. To
use this tag, the image you specify in the src attribute needs to be available on a
web server. To link an image to another web page (or a larger version of the
image), you simply nest the <img> tag inside an <a> tag. Here's an example of
linking an image. You can also link your image to an image map.
Syntax
<img>
This tag is Used by visual user agents to insert an image in the document.
The src attribute specifies the image URL. The required alt attribute
provides alternative text in case the image cannot be displayed.
a. BORDERS
• Border="1":
c. LINKED
• Linked In-line image with border="5"
Form-Associated Elements
Here are the elements that you can use with your forms.
• <input>
• <textarea>
• <button>
• <select>
• <option>
• <fieldset>
• <label>
First name:
Submit
Last name:
Attributes: Attributes specific to this tag:
Attribute Description
action Specifies a URI/URL of the page that will process the
form.
method Specifies the HTTP method to use when the form is
submitted.
enctype Specifies the content type used to encode the form data
set when it's submitted to the server.
accept Specifies a comma-separated list of content types that
the server accepts.
name Assigns a name to the form. This is used when
referencing the form with stylesheets or scripts. If there
are multiple forms, the name of each form must be
unique.
dir Specifies the direction of the text
target Specifies the target frame to load the destination page
as indicated with the action attribute.
TABLES
The HTML <table> tag is used for defining a table. The table tag contains other
tags that define the structure of the table. Tables consist of the <table> element
as well as other table-related elements. These other elements are nested inside
the <table> tags to determine how the table is constructed.
Table attributes
<tr>…</tr>
It Contains a row of cells in a table.
<th>…</th>
<td>…</td>
A table data cell.
<colgroup>…</colgroup>
Specifies a column group in a table.
<col> or <col/>
Specifies a column in a table.
<caption>…</caption>
Specifies a caption for a table.
<tbody>…</tbody>
Specifies a body of data for the table.
Table programming
i. CELL WIDTH
This cell
<TABLE BORDER="7"> will The first
<TR> expand to cell will
<TH WIDTH="50%">This cell will expand to 50% 50% if expand to
if the contents of the other cell will allow.</TH> the 50% if
<TH>The first cell will expand to 50% contents the
if the contents of this cell will allow.</TH> of the contents
</TR> other cell of this cell
</TABLE> will will allow.
allow.
ii. CELLPADDING
• CELLPADDING="10"
CELLSPACING
• CELLSPACING="10"
Elements
<frameset>…</frameset>
It Contains the frameset. The frames layout is given by comma separated
lists in the rows and cols attributes.
<frame> or <frame/>
It Delimits a single frame, or region, within the frameset. A separate
document linked with the src attribute appears inside.
<noframes>…</noframes>
It Contains normal HTML content for user agents that don't support
frames.
<iframe>…</iframe>
An inline frame places another HTML document in a frame. Unlike an
object element, an inline frame can be the "target" frame for links defined
by other elements and it can be selected by the user agent as the focus for
printing, viewing its source, etc.
Example <html>
<head>
<title>Frameset page<title> </head>
<frameset cols = "25%, *">
<noframes>
<body>Your browser doesn't support frames.
Therefore, this is the noframe version of the site.</body>
</noframes>
<frame src ="/html/tags/frame_example_left.html" />
<frame src ="/html/tags/frame_example_right.html" />
</frameset> </html>
Attributes: Attributes specific to this tag:
Attribute Description
name Assigns a name to a frame. This is useful for loading
contents into one frame from another.
src Location of the frame contents (for example, the
HTML page to be loaded into the frame).
noresize Specifies whether the frame is resizable or not (i.e.
whether the user can resize the frame or not).
Frame programming
1. SINGLE FRAMESET
Example code:
2. DOUBLE FRAMESET
Example code: