html body { margin-top: 50px !important; } #top_form { position: fixed; top:0; left:0; width: 100%; margin:0; z-index: 2100000000; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; border-bottom:1px solid #151515; background:#FFC8C8; height:45px; line-height:45px; } #top_form input[name=url] { width: 550px; height: 20px; padding: 5px; font: 13px "Helvetica Neue",Helvetica,Arial,sans-serif; border: 0px none; background: none repeat scroll 0% 0% #FFF; }
for paragraphs,
HTML Notes
HTML Notes
HTML Notes
Hyper Text Markup Language (HTML) is the building block for web pages.
Hypertext Markup Language (HTML) is a markup language used to create and link web pages.
Hypertext is a text which contains links to other text, possible else where
in the same document (internal linking) or in another document (external linking)
Features:
Easy to learn
Platform-independent
Support audio, video, and images embedded web pages
Supported by all browsers
Can be integrated with styling and scripting languages
Every HTML element has a default display value, depending on what type of element it is.
Block-level Elements
A block-level element always starts on a new line, and the browsers automatically add some space (a margin)
before and after the element.
A block-level element always takes up the full width available (stretches out to the left and right as far as it can).
Inline Elements
An inline element does not start on a new line.
These are the tags that tell a web browser where the HTML part in your document begins and
ends.
<html>
</html>
Let us now have a look at the basic structure of HTML. That is the code that is a must for every webpage to have:
HTML
<!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html>
Every Webpage must contain this code. Below is the complete explanation of each of the tag used in the above
piece of HTML code:
<!DOCTYPE html>: This tag is used to tells the HTML version. This currently tells that the version is HTML 5.
<html>: This is called HTML root element and used to wrap all the code.
<head>: Head tag contains metadata, title, page CSS etc. All the HTML elements that can be used inside the
<head> element are:
<style>
<title>
<script>
<meta>
<body>: All the content that you see rendered in the browser is contained within this element.
<head>
<title>
Example1
</title>
</head>
</body>
<!-- body tag ends here -->
</html>
Step 3: Go to the file menu and choose saveas option (File->saveas) and give the name of the
file as “example1.html” under root directory(C:)( or any valid path)
Step 4: After saving, an internet explorer icon will be displayed as shown below
Step 5: Double click to execute it. The output displayed following
Attributes
All HTML elements can have attributes · Attributes provide additional information about elements
All attributes are made up of two parts − a name and a value. The name is the property you want to set.
Body tag:-
Body tag contain some attributes such as bgcolor, background etc.
Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute can be
a hexadecimal number, an RGB value, or a color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
Color Values
Colors are defined using a hexadecimal notation for the combination of red, green, and blue color
values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest value
is 255 (hex #FF). This table shows the result of combining red, green, and blue:
The vlink attribute sets the color of links visited recently, alink the color of a currently
active link
Headings:-
HTML is having six levels of heading that are commonly used. The largest heading tag is
<h1> while <h6> defines the smallest.These heading tags also contain attribute called as align.
<h1 align=”left” | “right” | “center”> ........<h1>
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
Paragraph tag:-
Paragraphs are defined with the <p> tag
Most text is part of a paragraph of information. Each paragraph is aligned to the left, right or
center of the page by using an attribute called as align.
<p align=”left” | “right” | “center”>
Without <p> elements, the document becomes one large paragraph. HTML automatically adds an extra
blank line before and after a paragraph.
Horizontal Rule
The <hr> element is used for horizontal rules that act as dividers between sections, like this:
<html>
<body>
</body>
</html>
The horizontal rule does not have a closing tag. It takes attributes such as align and width. For
instance:
Attribute Value
Align left center right (Specifies the alignment of the horizontal rule. )
Font tag:-
This sets font size, color and relative values for a particular text.
<body>
<p><font color="red" face="Verdana" size="6">Your formatted text goes here</font>
Bjknnlkm
Kkld
ll</p>
</body>
Sample Output
color Color of text in either hexadecimal (ie: #RRGGBB format) or named color (ie: black, red, white)
face Font to use for text. Listed as one or more font names (comma separated)
Numeric values range from 1 to 7 (1 is the smallest, 7 is the largest, 3 is the default).
Text Styles or Cosmetic tags:- HTML provides a numerous range of tags for formatting the
text. If you want to format the text with different styles, just you include these tags one by
one before text.
<B>gggggg………</B> Bold Text
<U>……hhhhhh....</U> Underline Text
<I>………..</I> Displays as Italics
<EM>ggggg………</EM> For Emphasis (New Standard for Italics)
<STRONG>hhhhh………</STRONG> Strong or Bold text (New Standard for Bold)
<S>……….</S> or <DEL>…….</DEL> Strikes the text
<ADDRESS>……..</ADDRESS> Like address model (Looks like italics)
<PRE>……..</PRE> Considers spaces, new lines etc. As it is prints the information
Character tags like <strong> and <em> produce the same physical display as <b> and <i> but are
more uniformly supported across different browsers.
Example 2:
<marquee width="10%" behavior="scroll" bgcolor="pink">
This is an example of a scroll marquee...
</marquee>
Example 3:
Unordered Lists
An unordered list is a list of items marked with bullets (typically small black circles). An unordered list
starts with the <ul> tag. Each list item starts with the <li> tag.
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts
with the <ol> tag. Each list item starts with the <li> tag.
Ordered lists are specified almost exactly the same as unordered lists, only the <OL> tag is used instead
of the <UL> tag. A type attribute can be added to an ordered list, to define the type of the marker:
Type Description
type="1" The list items will be numbered with numbers (default)
type="A" The list items will be numbered with uppercase letters
type="a" The list items will be numbered with lowercase letters
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
Definition Lists
Definition lists consist of two parts: a term and a description. To mark up a definition list, you need
three HTML elements; a container <dl>, a definition term <dt>, and a definition description <dd>.
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment can be placed
anywhere in the document and the browser will ignore everything inside the brackets. You can use
comments to write notes to yourself, or write a helpful message to someone looking at your source
code.
Notice you don't see the text between the tags <!-- and -->. If you look at the source code, you
would see the comment. To view the source code for this page, in your browser window, select View
and then select Source.
Note: You need an exclamation point after the opening bracket <!-- but not before the
closing bracket -->.
HTML automatically adds an extra blank line before and after some elements, like before and after a
paragraph, and before and after a heading. If you want to insert blank lines into your document, use
the <br> tag.
Some characters have a special meaning in HTML, like the less than sign (<) that defines the start of
an HTML tag. If we want the browser to actually display these characters we must insert character
entities in place of the actual characters themselves.
Non-breaking Space
The most common character entity in HTML is the non-breaking space . Normally HTML will
truncate spaces in your text. If you add 10 spaces in your text, HTML will remove 9 of them. To add
spaces to your text, use the character entity.
HTML Links
HTML uses the <a> anchor tag to create a link to another document or web page.
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a
movie, etc. The syntax of creating an anchor:
Anchor tag is used for creating links.
Minimum it requires a parameter i.e., HREF, which indicates the destination document. Other
paramet target can be useful for the location of a frame where target page is to be displayed
respectively.
Target is optional.
<body bgcolor=cyan>
<h1 align=center>Overceas Publisher </h1>
<h3 align=center>All pages connected through links</h3>
<center>
<p >Company Details<A HREF=”1.html”>My Company</A></p>
<p>Book Details <A HREF=”2.html”>My Book</A></p>
<p> Author Details <A HREF=”3.html”> Author</A></p>
</center>
</body>
</html>
OUTPUT
To link directly to the top section, add a # sign and the name of the anchor to the end of a URL, like
this:
<h2>Anchor example</h2>
<h3><a name="menu">Menuhvjhbjkj
Jhjkhkj
Jh
hkjh</a></h3>
<ul>
</ul>
<h3><a name="a001">a001</a></h3>
<h3><a name="a002">a002</a></h3>
<h3><a name="a003">a003</a></h3>
<hr>
<body>
<a name="menu">Menu items</a><br>
<a href="#lession1">Lession.1</a><br />
<a href="#lession2">Lession.2</a><br />
<a href="#lession3">Lession.3</a><br />
<a href="#lession4">Lession.4</a><br />
<br />
Named anchors are often used to create "table of contents" at the beginning of a large document.
Each chapter within the document is given a named anchor, and links to each of these anchors are put
at the top of the document. If a browser cannot find a named anchor that has been specified, it goes
to the top of the document. No error occurs.
HTML Images
The <img> tag is empty, which means that it contains attributes only and it has no closing tag. To
display an image on a page, you need to use the src attribute. Src stands for "source". The value of
the src attribute is the URL of the image you want to display on your page. The syntax of defining an
image:
<img src="graphics/chef.gif">
Not only does the source attribute specify what image to use, but where the image is located. The
above image, graphics/chef.gif, means that the browser will look for the image name chef.gif in a
graphics folder in the same folder as the html document itself.
src="chef.gif" means that the image is in
the same folder as the html document calling
for it.
The browser puts the image where the image tag occurs in the document. If you put an image tag
between two paragraphs, the browser shows the first paragraph, then the image, and then the second
paragraph.
The alt attribute tells the reader what he or she is missing on a page if the browser can't load images.
The browser will then display the alternate text instead of the image. It is a good practice to include
the alt attribute for each image on a page, to improve the display and usefulness of your document for
people who have text-only browsers or use screen readers.
Image Dimensions
When you have an image, the browser usually figures out how big the image is all by itself. If you put
in the image dimensions in pixels however, the browser simply reserves a space for the image, then
loads the rest of the page. Once the entire page is loads it can go back and fill in the images. Without
dimensions, when it runs into an image, the browser has to pause loading the page, load the image,
then continue loading the page. The chef image would then be:
Tables
The HTML tables can be created by using <table> tag. By default, the table data is left aligned.
The table can be created by using <th>, <td>, and <tr> tags.
The <tr> tag specifies the table rows which is used to make a row.There must be at least one row in the
table.
The <th> tag defines the header cells in the table which are displayed as bold, center-aligned text.
The <td> tag defines the standard cells in the table which are displayed as normal-weight, left-aligned
text. The <td> tag specifies the table data cells which are used to make the column.
Attribute Description
align Alignment of the table. It can be one of the following values: left, center, right
cellpadding Space between the content of a cell and the border (in pixels)
Colspan Number
Rowspan Number
2. Table Caption
The caption for the table can be specified by using the <caption> tag.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Tag Usage</title>
</head>
<body>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
<tr>
<td>Dhoni</td>
<td>India</td>
</tr>
<tr>
<td>David Miller</td>
<td>South Africa</td>
</tr>
<tr>
<td>Joe Root</td>
<td>England</td>
</tr>
</table>
</body>
3. Table Cell Spacing
The space of the table cells can be defined by using the cellspacing attribute. The cellspacing attribute specifies the
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
<tr>
<td>Dhoni</td>
<td>India</td>
</tr>
<tr>
<td>David Miller</td>
<td>South Africa</td>
</tr>
<tr>
<td>Joe Root</td>
<td>England</td>
</tr>
</table>
</body>
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
<tr>
<td>Dhoni</td>
<td>India</td>
</tr>
<tr>
<td>David Miller</td>
<td>South Africa</td>
</tr>
<tr>
<td>Joe Root</td>
<td>England</td>
</tr>
</table>
</body>
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
<tr>
<td>Dhoni</td>
<td>India</td>
</tr>
<tr>
<td>David Miller</td>
<td>South Africa</td>
</tr>
<tr>
<td>Joe Root</td>
<td>England</td>
</tr>
</table>
</body>
Execute the above code, and it will display the below output:
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Tag Usage</title>
</head>
<body>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
<tr>
<td>Dhoni</td>
<td>India</td>
</tr>
<tr>
<td>David Miller</td>
<td>South Africa</td>
</tr>
<tr>
<td>Joe Root</td>
<td>England</td>
</tr>
</table>
</body>
What does colspan= do?
Allows a single table cell to span the width of more than one cell or column.
What does rowspan= do?
Allows a single table cell to span the height of more than one cell or row.
82 85 78 82 77 81
Using colspan= for single-row titling
<table>
<caption>Invoice</caption>
<tr>
<th>Item / Desc.</th>
<th>Qty.</th>
<th>@</th>
<th>Price</th>
</tr>
<tr>
<td>Paperclips (Box)</td>
<td>100</td>
<td>1.15</td>
<td>115.00</td>
</tr>
<tr>
<td>Paper (Case)</td>
<td>10</td>
<td>45.99</td>
<td>459.90</td>
</tr>
<tr>
<td>Wastepaper Baskets</td>
<td>2</td>
<td>17.99</td>
<td>35.98</td>
</tr>
<tr>
<th colspan="3">Subtotal</th>
<td>610.88</td>
</tr>
<tr>
<th colspan="2">Tax</th>
<td>7%</td>
<td>42.76</td>
</tr>
<tr>
<th colspan="3">Total</th>
<td>653.64</td>
</tr>
</table>
Subtotal 610.88
Tax 7% 42.76
Total 653.64
Bob Alice
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Colspan/Rowspan</title>
</head>
<body>
<table border = "1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr>
<td rowspan = "2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr>
<td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr>
<td colspan = "3">Row 3 Cell 1</td>
</tr>
</table>
</body>
</html>
output