Professional Documents
Culture Documents
Monika Gope
Lecturer
IICT, KUET
Learning Objectives
Web Browser
Features of the Browsers
HTML..
Web Browser
Web Browser
Features
Features
What is HTML?
HTML (Hyper-text Markup Language)
HTML is not a programming language,
A markup language is a set of markup tags
HTML uses markup tags to describe web pages
A markup language formats text in-between two
tags. These look like: <code>formatted text</code>
<code> begins the formatting tag
</code> ends the formatting tag
What is HTML5?
HTML Editors
HTML Tags
Basic Tags
HTML
<HTML></HTML>
These tags begin and end an HTML document.
HEAD
<HEAD></HEAD>
These tags are in the beginning of the document. Important information
is stored in-between these tags including: title, meta-data, styles, and
programming scripts
TITLE
<TITLE></TITLE>
These tags are in-between the HEAD tags and contain the text that
appears in the title of the Web page.
BODY
<BODY></BODY>
As you may have guessed, the BODY tags contain all the text in the
body of the document.
Editing HTML
We use a plain text editor (like Notepad) to edit HTML. We
believe this is the best way to learn HTML.
However, professional web developers often prefer HTML
editors like FrontPage or Dreamweaver, instead of writing
plain text. (advanced level)
This
example is a complete
Web page.
If viewed in a browser,
such as Internet Explorer,
it would have the title
Hello World
and the content Hello
World.
HTML Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
HTML Versions
HTML Versions
Since the early days of the web, there have been many
versions of HTML:
Dynamic HTML
HTML Elements
HTML Headings
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML Headings
HTML Paragraphs
HTML Links
HTML Images
HTML Attributes
Attribute Example
<a href="http://www.w3schools.com">This
is a link</a>
HTML Lines
HTML Comments
Example
<!DOCTYPE html>
<html>
<body>
<hr /> <!-- This is a comment -->
<p><b>This text is bold</b></p>
<p><strong>This text is strong</strong></p>
<p><i>This text is italic</i></p>
<p><em>This text is emphasized</em></p>
<p><code>This is computer output</code></p>
<p>This is<sub> subscript</sub> and
<sup>superscript</sup></p>
</body>
</html>
HTML Links
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<title> Links </title>
</head>
<body>
<a href ="table.html" target ="showframe">Table</a>
<br>
<a href ="lists.html" target ="showframe">Lists</a>
<br>
<a href ="forms.html" target ="showframe">Forms</a>
</body>
</html>
HTML <head>
HTML Images
<!DOCTYPE html>
<html>
<body>
<h2> Mountain Trip</h2>
<img border="0" src="/images/ Mountain.jpg" alt=" Mountain rock" width="304"
height="228">
</body>
</html>
Tag <ul></ul>
Tag <li></li>
Defines each List Entry
<html>
<body>
<h4>An Unordered List:</h4>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Green Tea</li>
</ul>
</body>
</html>
Ordered Lists
<html>
<body>
<h4>An Ordered List:</h4>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Green Tea</li>
</ol>
</body>
</html>
Nested Lists
Nested Lists
<html>
<body>
<h4>A nested List:</h4>
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
HTML Tables
<!DOCTYPE html>
<html>
<body>
<p>
Each table starts with a table tag.
Each table row starts with a tr tag.
Each table data starts with a td tag.
</p>
<h4>One column:</h4>
<table border="1">
<tr>
<td>100</td>
</tr>
</table>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
Table Span
<tr>
<td>This cell contains a list
<ul>
<li>apples</li>
<li>bananas</li>
<li>pineapples</li>
</ul>
</td>
<td>HELLO</td>
</tr>
</table>
</body>
</html>
Cell padding
<!DOCTYPE html>
<html>
<body>
<h4>Without cellpadding:</h4>
<table border="1">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<h4>With cellpadding:</h4>
<table border="1" cellpadding="10">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
Cell spacing
<!DOCTYPE html>
<html>
<body>
<h4>Without cellspacing:</h4>
<table border="1">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<h4>With cellspacing="0":</h4>
<table border="1" cellspacing="0">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<h4>With cellspacing="10":</h4>
<table border="1" cellspacing="10">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
HTML Blocks
HTML Blocks
DIV
Example: Div
<div style="color:#0000FF">
<h3>This is a heading</h3>
<p>This is a paragraph.</p>
</div>
Example Span
Html Layout
Website Layouts
Most websites have put their content in multiple columns
(formatted like a magazine or newspaper).
Multiple columns are created by using <div> or <table>
elements. CSS are used to position elements, or to create
backgrounds or colorful look for the pages.
<!DOCTYPE html>
<html>
<body>
<div id="container" style="width:500px">
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web
Page</h1></div>
<div id="menu" style="background-color:#FFD700;
height:200px;width:100px;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript</div>
<!DOCTYPE html>
<html>
<body>
<table width="500" border="0">
<tr>
<td colspan="2" style="background-color:#FFA500;">
<h1>Main Title of Web Page</h1>
</td>
</tr>
<tr>
<td style="background-color:#FFD700;width:100px;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript
</td>
<td style="backgroundcolor:#eeeeee;height:200px;width:400px;">
Content goes here
</td>
</tr>
<tr>
<td colspan="2" style="background-color:#FFA500;textalign:center;">
Copyright W3Schools</td>
</tr>
</table>
</body>
</html>
Output
Forms
Input
</form>
<p><b>Note:</b> The form itself is not visible. Also
note that the default width of a text field is 20
characters.
</p>
</body>
</html>
</form>
<p><b>Note:</b> The characters in a password field
are masked (shown as asterisks or circles).
</p>
</body>
</html>
Radio Buttons
Checkbox
<form>
<input type="checkbox" name="vehicle"
value="Bike">I have a bike<br>
Submit Button
Submit Button
<form name="input"
action="html_form_action.asp"
method="get">
Submit Button
Textarea
<!DOCTYPE html>
<html>
<body>
<textarea rows="10" cols="30">
The cat was playing in the garden.
</textarea>
</body>
</html>
Create a button
<!DOCTYPE html>
<html>
<body>
<form action="">
<input type="button" value="Hello world!">
</form>
</body>
</html>
fieldset legend
<form>
<fieldset>
<legend>Personalia:</legend>
Name: <input type="text" size="30"><br>
Email: <input type="text" size="30"><br>
Date of birth: <input type="text" size="10">
</fieldset>
</form>
Iframe
An iframe is used to display a web page within a web page.
<!DOCTYPE html>
<html>
<body>
<iframe src="demo_iframe.htm" frameborder="0"></iframe>
<p>Some older browsers don't support iframes.</p>
<p>If they don't, the iframe will not be visible.</p>
</body>
</html>
Iframe
<!DOCTYPE html>
<html>
<body>
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="http://www.w3schools.com"
target="iframe_a">W3Schools.com</a></p>
<p><b>Note:</b> Because the target of the link matches the name
of the iframe, the link will open in the iframe.</p>
</body>
</html>
Audio
<embed height="50" width="100" src="horse.mp3">
<object height="50"width="100"data="horse.mp3"></object>
Audio
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.ogg" type="audio/ogg">
Your browser does not support this audio format.
</audio>
Audio
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.ogg" type="audio/ogg">
<embed height="50" width="100" src="horse.mp3">
</audio>
Audio
Video
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
<object data="movie.mp4" width="320"
height="240">
<embed src="movie.swf" width="320"
height="240">
</object>
</video>
Color Values
HTML Entities
HTML Entities
HTML Entities
JavaScript
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Hello World!")
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>
<p>A browser without support for JavaScript will show the text in the
noscript element.</p>
</body>
</html>
Script