HTML Notes
HTML Notes
BASIC
What is HTML?
Background To put image instead of colour in Image name and <body background=“hi.jpg”>
the webpage extension
Leftmargin / blank area left from the edge of In pixel <body leftmargin=80>
Topmargin webpage
Text formatting using :
<B>,<U> , <I>,<sub> and <sup> Tags
• <B> -To make text/letter bold. E.g <b>Free Tibet</b> Output: Free Tibet
• <U> -To make text/letter Underline. E.g <u>Free Tibet</u> Output: Free Tibet
• <I> -To make text/letter Italic. E.g <i>Free Tibet</i> Output: Free Tibet
• <sub>-To make text/letter Subscript. E.g H <sub>2 </sub> Output: H2O
• <sup>-To make text/letter Superscript. E.g 1 <sub>st </sup> Output: 1st
OUTPUT/RESULT OF
HTML CODE HTML CODE
3. Text Formatting
• Text formatting tags modify the text between the opening tag and the closing tag
• Ex. <b>Hello</b> makes “Hello” bold
15
3. HTML HEADINGS
• HTML Headings
• Headings are defined with the <h1> to <h6> tags.
• <h1> defines the largest heading.
• <h6> defines the smallest heading.
• Example
<h1>This is a heading1</h1>
<h2>This is a heading2</h2>
<h3>This is a heading3</h3>
Browsers automatically adds an empty line before and after headings.
BASIC HTML TAGS
• Example
<html>
<head>
<title>Heading</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>
Attributes of Heading ( Align)
• The alignment can be of LEFT, CENTER and RIGHT values. The default
alignment is LEFT for <H#> tags.
• E.g. <H2 align=center>Level 2 heading</H2>
Text formatting using <P> and <BR> Tags
• The browser does not recognize returns (enter), tabs or even more than one space between letters. You must
tell it when to go the next line.
• Breaking Lines- <BR>
• To simply end one line and jump to the next, use a line break (<BR>). It is an empty tag.
•
• Changing paragraph Alignment <P>- ALIGN attribute
• The text that you type between <P> and </P> tags is by default left aligned. To change its alignment, you
can use ALIGN attribute of <P> tag.
• <P align=alignment>
• Where alignment can be either be LEFT or RIGHT or CENTER.
• E.g. <P align=left>
The text Formatting with <BASEFONT> and <FONT>
Each virtual size is successively 20% larger or smaller than the default font size
3.
2. The <FONT> tag:
• The <FONT> tag lets you change the size, style and color of text.
• Attributes:
1. Size: Lets you change the size of text(size =1-7)
e.g. <FONT size=7> Hello</FONT>
2. Color: To change color of the text.
e.g. <font color=red>Free Tibet</font>
3. Face: To change font type of the text you are displaying.
e.g. <font face=”Broadway, Arial, Times new roman”>Save Tibet</font>
Complete example of <font> tag.
<font size=6 color=blue face=“comic san ms”>Free Tibet</font>
Horizontal Rules- <HR> Tag.
• The <HR> tag produces a horizontal line spread across the width of the browser
window.
• Attributes:
1. Size: To set the size(thickness) of horizontal line.
e.g. <hr size=5>
2. Width: The length of horizontal rules can be controlled with width attribute
and value can be given in pixel or percentage.
e.g. <hr width=200> or <hr width=50%>
<LI>Orange
CODE
d. Orange
<LI>Mango e. Mango
</OL>
E.g. 3
Fruits: Fruits:
<OL type=”i” >
i. Apple
<LI>Apple.
<LI>Orange
CODE
ii. Orange OUTPUT
1. The src attribute-to specify image source: It is the value of the image
file’s URL or name of the image.
E.g. <img src=”d:\html\plant.gif”> or <img src=“plant.jpg”>
<img src="https://tibet.net/HHDL.png">
2. The alt attribute-to specify alternate text: The alt attribute specifies
alternative text the browser may show image display is not possible or
disable by the user. <IMG src=”newpic.gif” alt=”This is New Pic”>
The value for the alt attribute is a text string of up to 1024 characters, enclosed
in quotation marks if you include spaces or other punctuation.
3. The align attribute-for image alignment: The HTML standard
specifies five image-alignment attributes values: left, right, top,
middle and bottom.
e.g.<img src=“Tibet.jpg” align=right>
4. The height and width attributes: it specifies the height and
width of the image inserted in the web page.
e.g. <img src=“tibet.jpg" width="500" height="600">
5. The border attribute: it specifies the border to be placed
around the image.
e.g. <img src=”hello.jpg” alt=”hello test” align=right height=300 width=300
border=5>
TABLE
• Table display the data in tabular form. It allows you to arrange
data into rows and columns of cells.
VII 70
VIII 60
IX 40
X 32
STUDENT’S NAME FATHER’S NAME MOTHER’S NAME
KARMA TASHI TENZIN SONAM TASHI DOLMA
KALSANG LHAMO TENZIN DHONDUP PHUNTSOK DOLMA
<html>
<head>
<title>Table 2</title>
</head>
Table <body>
<table border=1 width=80%>
<tr bgcolor=yellow>
<th bgcolor=red>Student's Name</th>
<th>Father's Name</th>
<th>Mother's Name</th>
</tr>
<tr>
<td align=center>Karma Dolma</td>
CODE
<td background="pretty.jpg">Tashi
Tsering</td>
<td>Tenzin Dolma</td>
</tr>
</table>
</body>
</html>
Table Revision
• Tags used to create table are
2. <tr>/<td>/<th> attributes
1. <table> attributes • ALIGN
• BORDER • BACKGROUND
• WIDTH • BGCOLOR
• BORDERCOLOR
3. <td>/<th> attributes
• BGCOLOR, • ROWSPAN
• BACKGROUND • COLSPAN
• CELLPADDING • VALIGN
• CELLSPACING
4. <caption>
• ALIGN
3/07/2020
S. TAG ATTRIBUTE DESCRIPTION VALUE EXAMPLE
N
O
1 ALIGN To specify the content alignment left, center, right, justify <tr align=right>
<TR> of the row/cell <td align=right>
2 BACKGROUND To specify an image as the Name and path of the <tr background=“Tibet.jpg”>
<TD> background of the table image <td background=“Tibet.jpg”>
row/cell.
3 <TH> BGCOLOR To specify the row/cell Color name <tr bgcolor=green>
background color. <td bgcolor=green>
4 ROWSPAN How many rows space Specify the number of <td rowspan=3> SHORT
<TD> span/occupy by a cell. rows occupy by a cell. BREAK </td>
5 COLSPAN How many columns space Specify the number of <td colspan=2> BREAK
<TH> span/occupy by a cell. columns occupy by a </td>
cell.
(Table
6 Header) VALIGN To specify the Vertical Top, middle and bottom. <td rowspan=3
alignment of the data in a cell. valign=middle> Break </td>
7 To define the title or caption for <caption>TIME TABLE</caption>
<CAPTION>
the table
The <TR> Tag : It stands for Table Row. <TR> is used when you want a new table row to begin.
The <TH> Tag: It stands for Table Header. The contents declared as header are displayed in a bold.
Rowspan
R1
• How many rows space span/occupy by a ROWSPAN
cell. R2
<table border=1 width=40% height=40%>
<tr>
<td bgcolor=yellow>R1</td>
<td rowspan=2 bgcolor=green>ROWSPAN</td>
</tr>
<tr>
<td bgcolor=orange>R2</td>
</tr>
</table>
10/10/2020
Colspan
COLSPAN
• How many columns space span/occupy by a
cell. C1 C2
<table border=1 width=40% height=40%>
<tr>
<td bgcolor=yellow colspan=2>COLSPAN</td>
</tr>
<tr>
<td bgcolor=orange>C1</td>
<td bgcolor=green>C2</td>
</tr>
</table>
Embedding/inserting Video in the HTML
• The <video> tag allows to insert video in the HTML(website).
• Video format supported are .MP4, WEBM, OGG
• Attributes of <video> tag are
1. Src: (The URL/name of the video to embed)
2. Controls: (to control video playback, including volume, seeking, and pause/resume playback.)
3. Preload: (will load video when page load and let it ready to run)
4. Height: (the height of the video's display area)
5. Width: (the width of the video's display area)
6. Autoplay: (to play video automatically)
e.g. <video src="kitties.mp4" autoplay height=400 width=400 controls></video>
Embedding/inserting Audio in the HTML
• The <audio> tag allows to insert music in the HTML(website).
• Audio format supported are .MP3, WAV, OGG
• Attributes of <audio> tag are
1. Src
2. Autoplay
3. Controls:
4. Preload:
e.g. <audio src="kitty.mp3" autoplay controls></audio>
LINK
Bottom
R1
ROWSPAN
R2
COLSPAN
PRACTI
CAL ON
C1 C2
R1
ROWSPAN
R2