1 HTML
1 HTML
LANGUAGE (HTML)
Dr. Saw Myat Sandar
2
• There are so many open source web server package such as XAMPP,
WAMP(Windows users), MAMP (Mac OS X users) , LAMP (badass Linux users)
• The most popular Editor is Dreamweaver and others are Notepad, Notepad++,
Sublime Text and so on.
• Photoshop (pixel) and Illustrator (vector) are widely used to create design and
sometime Paint, FormatFactory application are used to design logo or images.
• XAMPP, which stands for Cross-Platform (X) Apache, MySQL, PHP and Perl, is a popular, free and open
source web server package that you can use to install a web server onto your desktop.
• Sublime Text is a sophisticated text editor for code, markup and prose.
• When comparing Sublime Text vs Notepad++, recommends Sublime Text for most people.
• The most important reason people chose Sublime Text is: Sublime Text has a top-down view of the file and
• It also supports a large number of languages and general text editing features out of the box.
• Lovely for the smooth user interface, extraordinary features and amazing performance.
4
Phone
Desktop Tablet
5
WHAT IS HTML?
• HTML stands for Hyper Text Markup Language, which is the most widely used language
• HTML was created by Berners-Lee in late 1991 but "HTML 2.0" was the first standard
• HTML 4.01 was a major version of HTML and it was published in late 1999.
• Though HTML 4.01 version is widely used but currently we are having HTML-5 version
which is an extension to HTML 4.01, and this version was published in 2012.
6
OUTLINES OF HTML
• Chapter 1: Structure
• Chapter 2: Text
• Chapter 3: Lists
• Chapter 4: Links
• Chapter 5: Images
• Chapter 6: Tables
• Chapter 7: Forms
CHAPTER 1: STRUCTURE
FIRST HTML PAGE: TAGS
<!DOCTYPE HTML>
<html> Opening tag <title>
<head> The contents of the <title>
element are either shown in the
<title>My First HTML Page</title> top of the browser, above where
</head> you usually type in the URL of the
page you want to visit, or on the
<body> tab for that page (if your
<p>This is some text...</p> browser uses tabs to allow you to
view multiple pages at the same
</body> time).
</html> Closing tag
An HTML element consists of an opening tag, a closing tag and the content inside.
CHAPTER 2: TEXT
HEADINGS
<h1>This is a Main Heading</h1>
• <h1> <h2>This is a Level 2 Heading</h2>
• <h2> <h3>This is a Level 3 Heading</h3>
<h4>This is a Level 4 Heading</h4>
• <h3> <h5>This is a Level 5 Heading</h5>
• <h4> <h6>This is a Level 6 Heading</h6>
• <h5>
• <h6>
• HTML has six "levels" of headings:
• <h1> is used for main headings
• <h2> is used for subheadings
12
PARAGRAPHS
• <p>
• To create a paragraph, surround the words that make up the paragraph with an opening <p> tag and
closing </p> tag. By default, a browser will show each paragraph on a new line with some space
between it and any subsequent paragraphs.
TEXT FORMATTING
Code Definition • Text formatting tags
<b></b> bold
modify the text
between the opening
<i></i> italicized tag and the closing tag
<u></u> underlined
<sup></sup>
<sub></sub>
Samplesuperscript
Samplesubscript
<q>
The <q> element is used
for shorter quotes that sit
<strong></strong> strong
within a paragraph.
<em></em> emphasized
<cite> Citations <p><cite>A Brief History of Time</cite> by Stephen Hawking has sold over ten million
copies worldwide.</p>
h1
h2
h4
P & sup
PROCEDURE
• Create a folder “html” on your desktop or local disk
• Open Sublime Text
• Go to File Tab New File
• Save as “index1.html” and write code <ht
• Write code as a screenshot
• Save this by clicking Ctrl+S
• Call Right Click and Open in Browser
CHAPTER 3: LISTS
<ol> <dl>
The definition list is created with the <dl>
The ordered list is created with the <ol> element and usually consists of a series of terms
element. and their definitions. Inside the <dl> element
<ul>
you will usually see pairs of <dt> and <dd>
elements.
1. Apple i. Apple
2. Orange ii. Orange
3. Grapefruit iii. Grapefruit
a. Apple
A. Apple b. Orange I. Apple
B. Orange c. Grapefruit II. Orange
C. Grapefruit III. Grapefruit
19
• Definition is indented
<dl>
<dt>HTML</dt>
<dd>A markup language …</dd>
<dt>CSS</dt>
<dd>Language used to …</dd>
</dl>
LISTS – EXAMPLE 21
<ol type="1">
<li>Apple</li>
TEST YOURSELF
<li>Orange</li>
<li>Grapefruit</li>
</ol>
<ul type="disc">
<li>Apple</li>
<li>Orange</li>
<li>Grapefruit</li>
</ul>
<dl>
<dt>HTML</dt>
<dd>A markup lang…</dd>
</dl>
22
CHAPTER 4: LINKS
• <a> other-sites.html HTML
• Links are created using the <a> element which <p>Movie Reviews:
<ul>
has an attribute called href. The value of the href
<li><a href="http://www.empireonline.com">
attribute is the page that you want people to go to Empire</a></li>
<li><a href="http://www.metacritic.com">
when they click on the link. Users can click on
Metacritic</a></li>
anything that appears between the opening <a> <li><a
href="http://www.rottentomatoes.com">
tag and the closing </a> tag and will be taken to
Rotten Tomatoes</a></li>
the page specified in the href attribute. </ul>
</p>
23
CHAPTER 5: IMAGES
<img src="images/quokka.jpg" alt="A family of quokka" title="The quokka is
an Australian marsupial that is similar in size to the domestic cat." />
<figure>
<img src="images/otters.jpg" alt="Photograph of
<figure>
two sea otters floating in water"> Images often come with
<br /> captions. HTML5 has
<figcaption>Sea otters hold hands when they introduced a new <figure>
Sleep. </figcaption> element to contain images and
</figure> their caption so that the two
are associated.
<figcaption>
The <figcaption> element has been added to HTML5 in
order to allow web page authors to add a caption to an image.
26
MARQUEE
<marquee> <marquee direction="down">
<img src="images/redcar.png" width="300" height="200"> <img src="images/redcar.png" width="300" height="200">
<img src="images/camry-red.jpg" width="300" <img src="images/camry-red.jpg" width="300"
height="200"> height="200">
<img src="images/corolla.jpg" width="300" height="200"> <img src="images/corolla.jpg" width="300"
<img src="images/prius.jpg" width="300" height="200"> height="200">
</marquee> <img src="images/prius.jpg" width="300" height="200">
</marquee>
<marquee direction="up">
<img src="images/redcar.png" width="300" height="200"> <marquee behavior="alternate">
<img src="images/camry-red.jpg" width="300" <img src="images/redcar.png" width="300" height="200">
height="200"> <img src="images/camry-red.jpg" width="300"
<img src="images/corolla.jpg" width="300" height="200"> height="200">
<img src="images/prius.jpg" width="300" height="200"> <img src="images/corolla.jpg" width="300"
height="200">
</marquee>
<img src="images/prius.jpg" width="300" height="200">
• </marquee>
27
THANK YOU
FOR
YOUR ATTENTION !!!
28
CHAPTER 6: TABLES
• Tables represent tabular data
• <tbody> denotes collection of table rows that contain the very data
• <tfoot> denotes table footer but comes BEFORE the <tbody> tag
• <colgroup> and <col> define columns (most often used to set column widths)
COMPLETE HTML TABLE: EXAMPLE
32
<table>
columns
<colgroup>
<col style="width:100px" /><col />
</colgroup>
header th
<thead>
<tr><th>Column 1</th><th>Column 2</th></tr>
</thead>
footer
<tfoot>
<tr><td>Footer 1</td><td>Footer 2</td></tr>
</tfoot>
Last comes the body (data)
<tbody>
<tr><td>Cell 1.1</td><td>Cell 1.2</td></tr>
<tr><td>Cell 2.1</td><td>Cell 2.2</td></tr>
</tbody>
</table>
33
<table>
COMPLETE HTML TABLE:
<colgroup>
<col style="width:200px" /><col /> By default, header text is bold and
</colgroup>
centered.
<thead>
<tr><th>Column 1</th><th>Column 2</th></tr>
</thead>
<tfoot>
<tr><td>Footer 1</td><td>Footer 2
</td></tr>
</tfoot>
<tbody>
<tr><td>Cell 1.1</td><td>Cell 1.2</td></tr>
<tr><td>Cell 2.1</td><td>Cell 2.2</td></tr>
</tbody>
</table>
34
NESTED TABLES
• Table data “cells” (<td>) can contain nested tables
(tables within tables):
<table>
<tr>
<td>Contact:</td>
<td>
<table>
<tr>
<td>First Name</td>
<td>Last Name</td>
</tr>
</table>
</td>
</tr>
</table>
35
cellspacing cellpadding
<html>
<head><title>Table Cells</title></head>
<body>
<table cellspacing="15" cellpadding="0">
<tr><td>First</td>
<td>Second</td></tr>
</table>
<br/>
<table cellspacing="0" cellpadding="10">
<tr><td>First</td><td>Second</td></tr>
</table>
</body>
</html>
38
colspan rowspan
colspan="2" rowspan="1"
Defines how many columns the cell Defines how many rows the cell occupies
occupies
COLUMN AND ROW SPAN – EXAMPLE
<table> <tfoot>
<tr> <tbody>
<td> Cellspacing
<thead> Cellpadding
<th> Border
Colspan Align
rowspan
Cell[1,1] Cell[2,1]
Cell[1,2] Cell[3,2]
Cell[2,2]
Cell[1,3] Cell[2,3]
39
40
CHAPTER 7: FORMS
• There are several types of form controls that you can use to collect information from visitors to your site. Three
types of Forms are
1. Adding Text,
2. Making Choices,
3. Submitting Forms
ADDING TEXT
Text input Password input Text area (multi-line)
(single-line) Used for a single Like a single line text box but it For longer areas of text, such as
line of text such as email masks the characters entered. messages and comments.
addresses and names.
41
FORM
<form action="login.php">
<p>Username:
<input type="text" name="username" size="15“ maxlength="30" />
</p>
</form>
<form> action
Every <form> element requires
Form controls live inside a an action attribute. Its value
method
<form> element. This element is the URL for the page on the
should always carry the action server that will receive the
attribute and will usually have a information in the form when it Forms can be sent using one of
method and id attribute too. is submitted. two methods: get or post.
43
HTML FORMS
• Forms are the primary method for gathering data from site visitors
• Create a form block with
The “method" attribute tells how the form data
<form></form>
should be sent – via GET or POST request
• Example:
FORM FIELDS
• Single-line text input fields:
<input type="text" name="FirstName" value="This
is a text field" />
FIELDSETS
• Fieldsets are used to enclose a group of related form fields:
<form method="post" action="form.php">
<fieldset>
<legend>Client Details</legend>
<input type="text" id="Name" />
<input type="text" id="Phone" />
</fieldset>
<fieldset>
<legend>Order Details</legend>
<input type="text" id="Quantity" />
<textarea cols="40" rows="10"
id="Remarks"></textarea>
</fieldset>
</form>
• Radio buttons:
<input type="radio" name="title" value="Mr." />
• Submit button:
<input type="submit" name="submitBtn"
value="Apply Now" />
48
• Multiple select field – displays the list of items in multiple lines, instead of one
<form enctype="multipart/form-data">
<input type="file" name="photo" />
</form>
51
LABELS
• <label> element can be used in two ways. It can:
• 1. Wrap around both the text description and the form input (as shown on the first line of the
example to your right).
• 2. Be kept separate from the form control and use the for attribute to indicate which form
control it is a label for (as shown with the radio buttons).
• for
• The for attribute states which form control the label belongs to.
FORM VALIDATION
• Forms on the web that give users messages if the form control has not been filled in correctly; this
is known as form validation. Normally used “required”.
<form action="http://www.example.com/login/"
method="post">
<label for="username">Username:</label>
<input type="text" name="username“ required="required" /></title><br/>
<label for="password">Password:</label>
<input type="password" name="password“ required="required" />
<input type="submit" value="Submit" />
</form>
54
THANK YOU
FOR
YOUR ATTENTION !!!
56
VIDEO
poster src
<video> This attribute allows you to This attribute specifies the path
to the video
The <video> element has a specify an image to show while
number of attributes which allow the video is downloading or until
you to control video playback: the user tells the video to play.
loop auto
When used, this attribute preload The browser should download
the video when the page loads.
indicates that the video should This attribute tells the browser
start playing again once it has what to do when the page
ended. loads. It can have one of three
values:
58
Test Yourself
metadata <video width="320" height="240" controls>
The browser should just collect <source src="C:\Users\SMSD\Desktop\smsd\
information such as the size, aa.mp4" type="video/mp4">
first frame, track list, and </video>
duration.
AUDIO
<source> <audio controls>
To specify the location of the file <source src="horse.mp3" type="audio/mpeg">
to be played, you can use the
<source> element inside the </audio>
<video> element. (This should
replace the src attribute on the
opening <video> tag.)
59
Because there have been several versions of HTML, each web page should begin with a DOCTYPE
declaration to tell a browser which version of HTML the page is using (although browsers usually
display the page even if it is not included).
<!-- --> - good idea to add comments to your code because, no matter how familiar you
are with the page at the time of writing it, when you come back to it later
ID ATTRIBUTE & CLASS
60
ATTRIBUTE
• the id attribute, it is used to uniquely identify that element from other elements on the page. Its
value should start with a letter or an underscore. id attribute is known as a global attribute because
it can be used on any element.
• a class attribute, sometimes, rather than uniquely identifying one element within a document, you
will want a way to identify several elements as being different from the other elements on the page.
no two elements on the same page have the
<p id="pullquote">Every time I view the sea same value for their id attributes
I feel a calming sense of security, </p>
The id attribute of an HTML tag can be used to
<p class="important">For a one-year period uniquely identify any element within an HTML
from November 2010, the Marugame Genichiro- page.
Inokuma Museum of Contemporary Art (MIMOCA) The class attribute is used to associate an
will host a cycle of four Hiroshi Sugimoto element with a style sheet, and specifies the
exhibitions.</p> class of element.
61
The <span> element acts like an inline equivalent of the <div> <p>Anish Kapoor won the
element. It is used to either: Turner Prize in 1991 and
1. Contain a section of text where there is no other suitable element to exhibited at the <span
differentiate it from its surrounding text class="gallery">Tate
2. Contain a number of inline elements The most common reason why Modern</span> gallery in
people use <span> elements is so that they can control the appearance London in 2003.</p>
of the content of these elements using CSS.
62
• <div> tag is used to identify a blocklevel section/division of a document that has a line break both before and after it.
• Some elements will always appear to start on a new line in the browser window. These are known as block level elements.
elements. Examples of inline elements are <a>, <b>, <em>, and <img>.
63
META
• Meta tags additionally describe the content contained within the page
<meta name="description"
content="HTML tutorial" />
<meta charset=“UTF-8"/>
<meta name="author"
content="Chris Brewer" />
<meta http-equiv="refresh"
content="5;
url=http://www.telerik.com"
/>
HTML 5 authors can use simple syntax to specify Character Encoding as follows
<meta charset="UTF-8"> syntax is case-insensitive
<iframe>
64
IFRAMES
HTML Need to embed using this website
An iframe is like a little window that has https://www.mapsdirections.info/en/custom-google-maps/
been cut into your page — and in that
window you can see another page. The
term iframe is an abbreviation of inline
frame.
<iframe
src="http://
maps.google.co.uk/maps?
q=moma+new+York
&output=embed"
width="450"
height="350"
frameborder="0"
scrolling="no">
</iframe> it indicates whether the frame should have a border or not. A
value of 0 indicates that no border should be shown. A value of
1 indicates that a border should be shown.
HTML Special Characters 65
THANK YOU
FOR
YOUR ATTENTION !!!