Short Note For All G-12
Short Note For All G-12
By ASNE K.
HTML (Hyper Text Markup Language)
is a markup language (markup -instructions for layout and style). is used to tell a Web browser
where the heading is for a Web page,
what is a paragraph,
what is part of a table and so on, so it can structure your document and render it properly.
Syntax:
<element name> Content here </element name>
Open tag Close tag
It is recommended to use lowercase in all elements since required for HTML documents.
Structure of A page
HTML documents are contained between the opening <html> and closing </html> called root element
Inside the root element the document is divided in to two
The <head> element, which contains information about the document such as a title or a link to a style sheet
The <body> element, which contains the real content of the document that you see.
Simple page
<html>
<head>Title here
<title> my first page </title>Web page content here
</head>
<body>
WELCOME TO MY FIRST WEB PAGE
</body>
</html>
Attributes used with <BODY
BGCOLOR: used to set the background color for the document
Example: <BODY BGCOLOR="yellow">
Your document text goes here.
</BODY>
TEXT: used to set the color of the text of the document
Example: <BODY TEXT="red">
Document text changed to red color
</BODY>
MARGINS: set the left hand/right hand margin of the document
LEFTMARGIN: set the left hand margin of the document
Example: <BODY LEFTMARGIN="60">
This document is indented 60 pixels from the left hand side of the page.
</BODY>
TOPMARGIN: set the left hand margin of the document
Example: <BODY TOPMARGIN="60">
This document is indented 60 pixels from the top of the page.
</BODY>
By ASNE K.
BACKGROUND: It is used to point to an image file (the files with an extension .gif, .jpeg) that will be used as the
background of the document. The image file will be tiled across the document.
Example: <BODY BACKGROUND="filename.gif">
Your document text goes here
</BODY>
Heading Tag
Example
<!DOCTYPE html>
<html>
<head>
<title>Heading Example</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
OUTPUT ☞
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
In order to control your paragraph and line breaks, <P> and <BR> tags are used.
Using paragraph tag: <P>
This tag <P> indicates a paragraph, used to separate two paragraphs with a blank line.
Example:
By ASNE K.
<P> Welcome to the world of HTML </P>
<P> First paragraph.
Text of First paragraph goes here </P>
Paragraph Tag
The <p> tag offers a way to structure your text into different paragraphs. Each paragraph of text should go in between an opening <p>
and a closing </p> tag
Example
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<p>Here is a first paragraph of text.</p>
<p>Here is a second paragraph of text.</p>
<p>Here is a third paragraph of text.</p>
</body>
</html>
OUTPUT ☞
Here is a first paragraph of text.
Here is a second paragraph of text.
Here is a third paragraph of text.
Thanks
Mahnaz
By ASNE K.
Sabian Secondary School
Dire Dawa
</PRE>
Italic Text
Anything that appears within <i>...</i> element is displayed in italicized as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Italic Text Example</title>
</head>
<body>
<p>The following word uses a <i>italicized</i> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses an italicized typeface.
Underlined Text
Eample
<!DOCTYPE html>
<html>
<head>
<title>Underlined Text Example</title>
</head>
<body>
<p>The following word uses a <u>underlined</u> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses an underlined typeface.
Centering Content
You can use <center> tag to put any content in the center of the page or any table cell.
Example
<!DOCTYPE html>
<html>
<head>
<title>Centering Content Example</title>
</head>
<body>
<p>This text is not in the center.</p>
<center>
<p>This text is in the center.</p>
</center>
</body>
</html>
OUTPUT ☞
This text is not in the center.
This text is in the center
By ASNE K.
Strike Text Tag
Example
<!DOCTYPE html>
<html>
<head>
<title>Strike Text Example</title>
</head>
<body>
<p>The following word uses a <strike>strikethrough</strike> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a strikethrough typeface.
Monospaced Font
Example
<!DOCTYPE html>
<html>
<head>
<title>Monospaced Font Example</title>
</head>
<body>
<p>The following word uses a <tt>monospaced</tt> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a monospaced typeface
Superscript Text
The content of a <sup>...</sup> element is written in superscript; the font size used is the
same size as the characters surrounding it but is displayed half a character's height above
the other characters.
Example
<!DOCTYPE html>
<html>
<head>
<title>Superscript Text Example</title>
</head>
<body>
<p>The following word uses a <sup>superscript</sup> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a superscript typeface.
Subscript Text
The content of a <sub>...</sub> element is written in subscript; the font size used is the same as the characters surrounding it, but is
displayed half a character's height beneath the other characters.
Example
<!DOCTYPE html>
<html>
<head>
<title>Subscript Text Example</title>
</head>
<body>
<p>The following word uses a <sub>subscript</sub> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a subscript typeface
By ASNE K.
Inserted Text
Anything that appears within <ins>...</ins> element is displayed as inserted text.
Example
<!DOCTYPE html>
<html>
<head>
<title>Inserted Text Example</title>
</head>
<body>
<p>I want to drink <del>cola</del> <ins>wine</ins></p>
</body>
</html>
OUTPUT ☞
I want to drink cola wine
Deleted Text
Anything that appears within <del>...</del> element, is displayed as deleted text.
Example
<!DOCTYPE html>
<html>
<head>
<title>Deleted Text Example</title>
</head>
<body>
<p>I want to drink <del>cola</del> <ins>wine</ins></p>
</body>
</html>
OUTPUT ☞
I want to drink cola wine
Larger Text
The content of the <big>...</big> element is displayed one font size larger than the rest of the text surrounding it as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Larger Text Example</title>
</head>
<body>
<p>The following word uses a <big>big</big> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a big typeface.
Smaller Text
The content of the <small>...</small> element is displayed one font size smaller than the rest of the text surrounding it as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Smaller Text Example</title>
</head>
<body>
<p>The following word uses a <small>small</small> typeface.</p>
</body>
</html>
OUTPUT ☞
The following word uses a small typeface.
By ASNE K.
The dir Attribute
The dir attribute allows you to indicate to the browser about the direction in which the text should flow. The dir attribute can take one of
two values, as you can see in the table that follows:
Value Meaning
ltr Left to right (the default value)
rtl Right to left (for languages such as Hebrew or Arabic that are read right to left)
Example
<!DOCTYPE html>
<html dir="rtl">
<head>
<title>Display Directions</title>
</head>
<body>
This is how IE 5 renders right-to-left directed text.
</body>
</html>
OUTPUT ☞
This is how IE 5 renders right-to-left directed text.
Grouping Content
The <div> and <span> elements allow you to group together several elements to create sections or subsections of a page.
For example, you might want to put all of the footnotes on a page within a <div> element to indicate that all of the elements within that
<div> element relate to the footnotes.
You might then attach a style to this <div> element so that they appear using a special set of style rules.
Example
<!DOCTYPE html>
<html>
<head>
<title>Div Tag Example</title>
</head>
<body>
<div id="menu" align="middle" >
<a href="/index.htm">HOME</a> |
<a href="/about/contact_us.htm">CONTACT</a> |
<a href="/about/index.htm">ABOUT</a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Content Articles</h5>
<p>Actual content goes here.....</p>
</div>
</body>
</html>
OUTPUT ☞
HOME | CONTACT | ABOUT
CONTENT ARTICLES
Comments
You can put comments between any tags in your HTML documents. Comments use the following syntax:
Syntax: <!-- comment goes here -->
<!-- This is a comment -->
<!-- This is a multiple-line comment that ends here. -->
Lists
HTML Supports several ways of arranging items in lists.
You can create three types of lists :
Unordered lists:- which are like lists of bullet points
Ordered lists:- which use a sequence of numbers or letters instead of bullet points
Definition lists:- which allow you to specify a term and its definition
Unordered lists
An unordered list starts with in <UL> followed by <LI> (List Item) tag.
syntax:
<ul>
<li> . . . </li>
<li> . . . </li>
</ul>
Example : <UL>
<LI> Apple </LI>
<LI> Mango </LI>
<LI> Orange </LI>
</UL>
Attributes: type is disc, circle, or square
Ordered lists
Ordered list starts with in <OL> followed by <LI> (List Item) tag.
syntax:
<ol>
<li> . . . </li>
<li> . . . </li>
</ol>
Example : <OL>
<LI> Apple </LI>
<LI> Mango </LI>
<LI> Orange </LI>
</OL>
By ASNE K.
Attributes of <OL> tag:
TYPE: allows marking list items with different types. By default the list Item markers are set to numbers 1,2,3… so on.
START: used for lists that need to start at values other than 1. START always specified in default numbers, and is completed
based on TYPE before display, For example, If START =5 it would display either an ‘E’, ‘e’, ‘V’, ‘v’, or ‘5’ based an TYPE
attribute.
Example : <OL TYPE=“A” START=3>
<LI> Apple </LI>
<LI> Mango </LI>
<LI> Orange </LI>
</OL>
Definition lists
A special kind of list for providing terms followed by a short text definition and description of them.
Example : <dl>
<dt> student name </dt>
<dd> mulualem alemu </dd>
<dd> alemu mekonen </dd>
<dd> solomon ayele </dd>
<dt> instructures name </dt>
<dd>abebeb alem </dd>
<dd>taye endalew</dd>
<dd>almaze kebebech</dd>
</dl>
Links
A link is specified using the anchor <a> element.
Anything between the opening <a> tag and the closing </a> tag becomes part of the link a user can click in a browser.
To link to another document, the opening <a> tag must carry an attribute called href, whose value is the page you are linking to.
<body>
Go to the <a href=“first.html">first page </a>
</body>
The file first.html should be in the same folder
Linking to a website
to link to a different site you need to write the URL between the <a> and </a> tags - source anchor,
<body>
You can also <a href=http://www.facebook.com/> facebook</a>?
</body>
You can include title attribute to links – when the mouse is over the link additional information could be delivered to the user.
By ASNE K.
<body>
<a href="http://www.facebook.com/" title=“search the Web with face book">Facebook</a>
is a very popular social networking.
</body>
By ASNE K.