SlideShare ist ein Scribd-Unternehmen logo
1 von 36
WEB ENGINEERING
Course Code CSI-654
Hypertext Markup Language (HTML)
Part-II
HTML
Table
HTML tables enable to effectively present large amounts of data in rows and columns.
Table Structure
A table is basically a rectangle containing rows and columns. The places where the columns and
rows intersect are called cells. Each cell can hold Web page content.
Cell Spanning
Cells can span two or more columns or rows to form bigger containers for data. For example, a
table may include a title cell at the top that spans multiple columns across the table, or one that
extends downward across several rows.
Tables are defined with the <table> tag.
A table is divided into rows with the <tr> tag, and each row is divided into data cells with the
<td> tag. The <td> stands for "table data," which is the content of a data cell. A data cell can
contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.
Table Elements
HTML
Table
<html>
<body>
<table border="1">
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>400</td>
<td>500</td>
<td>600</td>
</tr>
</table>
</body>
</html>
<html>
<body>
<table
border="3"bordercolor=#0033CC>
<tr> <th>My Class</th>
<th>My KAIMS</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>
</body>
</html>
HTML
Table
Code Example…
HTML
Table (Extend Cells across Columns and Rows)
A larger cell in a table can be create by extending the cell across two or more columns
or rows. The ability to span cells, also called merging cells.
Consider the tag for the cell to extend across columns. Type COLSPAN=“?”,
OR
ROWSPAN=“?” replacing ? with the number of columns to span.
Code Example…
HTML
Table (Cell Padding and Spacing)
Padding to add space between the border and the contents of a cell, while spacing is
used to increase the border size or distance between cells. Padding and spacing size is
measured in pixels.
In the <TABLE> tag, type CELLPADDING=”? ”, replace ? with the pixel value
<html>
<body>
<h4>Table border with cellpadding:</h4>
<table border="1" cellpadding=10>
<tr>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>three</td>
<td>four</td>
</tr>
</table>
</body>
</html>
HTML
Table (Cell Padding and Spacing)
In the <TABLE> tag, type CELLSPACING=”? ”, replace ? with the pixel value
<html>
<body>
<h4>Table border with cellpadding:</h4>
<table border="1" cellspacing=10>
<tr>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>three</td>
<td>four</td>
</tr>
</table>
</body>
</html>
HTML
Table (Tags inside a table)
Code Example…
HTML
Table (Cell Width and Height)
A cell’s width can be control using the WIDTH attribute and its height using the
HEIGHT attribute. This enables to allocate more space to columns or rows that have
more content. If a specific width or height is not set, the content of the cell determines
the cell’s size.
In the <TD> tag, type WIDTH=”?”, replacing ? with the value or percentage to set the
cell.
<html>
<body>
<h4>Table Cell Width and Height</h4>
<table border="1">
<tr><td width=100>one</td>
<td>two</td> </tr>
<tr>
<td height=120>three</td>
<td>four</td>
</tr>
</table>
</body>
</html>
HTML
Table (Column Header)
Type <TH> after the <TR> tag for the row to use as column labels.
<html>
<body>
<h4>Table with Column Header/ Label</h4>
<table border="1">
<tr>
<th>Name</th>
<td>City</td>
<td>Country</td>
</tr>
<tr>
<td>Kazim</td>
<td>multan</td>
<td>Pakistan</td>
</tr>
</table>
</body>
</html>
HTML
Table (Insert background image)
<html>
<title>Table background image</title>
<body>
<h4>A background image</h4>
<table border="1" background="table-background.jpg">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
Code Example…
HTML
Table (Add a background color or a background image to a table cell)
<html>
<body>
<h4>Cell backgrounds:</h4>
<table border="1">
<tr>
<td bgcolor="green">First</td>
<td>second</td>
</tr>
<tr><td>
< background="table-background.jpg"> third</td>
<td>fourth</td>
</tr>
</table>
</body>
</html>
HTML
Table (Align the content in a table cell)
Code Example…
HTML
Table (Newspaper Style Columns)
The table format may be used to present columns of text on Web page, much like a newspaper.
The text may be organize into two or three columns. Paragraphs of text are contained within each
column. The vertical alignment attribute to make each column align at the top of the table.
Within the <TR> and </TR> tags, type <TD VALIGN=”top”> to start the first column
of text.
Code Example…
HTML
Forms
A form allows a user to enter data that is sent to a server for processing. It is a section of a
document containing normal content, markup, special elements called controls (checkboxes, radio
buttons, menus, etc.), and labels on those controls.
The most important form element is the input element. It is used to select user information. It can
vary in many ways, depending on the type attribute and can be of type text field, checkbox,
password, radio button, submit button, and more.
The <form> tag is used to create an HTML form
<form>
.
input elements
.
</form>
HTML
Forms (Text Fields)
<html>
<body>
<form action=“ ">
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
</body>
</html>
(password Field)
<form action="">
Username: <input type="text" name="user"><br>
Password: <input type="password"
name="password">
</form>
HTML
Forms (Check Boxes)
<form action="">
<input type="checkbox" name="myclass" value="Web">Web Engineering<br>
<input type="checkbox" name="myclass" value="pm">Project Management
</form>
(Radio buttons)
<form action="">
<input type="radio" name=“myradio" value="male">Male<br>
<input type="radio" name=“myradio" value="female">Female
</form>
HTML
Forms (Drop-down list simple)
(Drop-down list with a pre-selected value)
<form action="">
<select name="subject">
<option value="web">Web Engineering</option>
<option value="pm">Project
Management</option>
<option value="c++">C++</option>
<option value="java">Java</option>
</select></form>
<form action="">
<select name="subject">
<option value="web">Web Engineering</option>
<option value="pm">Project Management</option>
<option value="c++">C++</option>
<option value="java">Java</option>
<option value="DE" selected="select">Digital
Electronic</option>
<option value="DSP">Digital Signal Processing</option>
</select></form>
HTML
Forms (Textarea multi-line text input field)
<html>
<body>
<textarea rows="10" cols="30"> A friend is someone who is there for you when he'd rather be
somewhere else. Only your real friends tell you when your face is dirty. </textarea>
</body>
</html>
HTML
Forms (Button)
<form action="">
<input type="button" value=“Welcome">
</form>
Border around form-data (fieldset)
<form action="">
<fieldset>
<myborder>Personal information:</myborder>
Name: <input type="text" size="30"><br>
E-mail: <input type="text" size="30"><br>
Date of birth: <input type="text" size="10">
</fieldset></form>
HTML
Forms (GET and POST method)
GET method
The method attribute specifies how to send form-data (the form-data is sent to the page specified in
the action attribute). The form-data can be sent as URL variables (with method="get") or as HTTP
post transaction (with method="post").
<form name="myform" action="myform.aspx" method="get">
First name: <input type="text" name="FirstName" value="Nasir"><br>
Last name: <input type="text" name="LastName" value="Qasim"><br>
<input type="submit" value="Submit">
</form>
When Submit button is clicked, the form-data will be sent to a page myform.aspx
Code Example…
HTML
Forms (GET and POST method)
GET method
<form name="input" action="myform.aspx" method="get">
<input type="checkbox" name="myclass" value="web">Web Engineering<br>
<input type="checkbox" name="myclass" value="pm">Project Management
<br><br>
<input type="submit" value="Submit">
</form>
Code Example…
Radio buttonsand submit button
<form name="input" action="myform.aspx" method="get">
<input type="radio" name="mychoice" value="male">Male<br>
<input type="radio" name="mychoice" value="female">Female<br>
<input type="submit" value="Submit">
</form>
Code Example…
HTML
Forms (GET and POST method)
POST method
The POST request method is used when the client needs to send data to the server as part of the
request (behind the scenes), such as when uploading a file or submitting a completed form.
<form action=“mailto:info@kaims.edu.pk" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="myname" value="your name..."><br>
E-mail:<br>
<input type="text" name="mymail" value="your email..."><br>
Comment:<br>
<input type="text" name="mycomment" value="please leave your comments...." size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
Code Example…
HTML
Layout
The webpage layout follows a certain basic design structure.
<div> Elements
It is a block level element used for grouping HTML elements. Multiple columns are created by
using <div> or <table> elements
HTML
Layout
<div> Elements
It is a block level element used for grouping HTML elements. Multiple columns are created by
using <div> or <table> elements
Code Example using div Code Example using table
HTML
Frame
Frames allow for multiple .html documents to be displayed inside of one browser window at a
time. Frames can divide the screen into separate windows.
HTML
Frame (frameset)
<html>
<frameset rows="50%,50%">
<frame src="header.htm">
<frameset cols="18%,82%">
<frame src="menu.htm">
<frame src="main.htm">
</frameset>
</frameset>
</html>
Code Example
HTML
Iframe (Inline frame)
It is used to display the embedded data inside a sub window of the browser's window.
Code Example
HTML
Multimedia
Multimedia on the web is sound, music, videos, and animations. Multimedia comes in many
different formats. It can be almost anything, hear or see like text, pictures, music, sound, videos,
records, films, animations, and more.
Multimedia elements (like sounds or videos) are stored in media files. The most common way to
discover the media type is to look at the file extension.
Object
The <object> element supports the HTML helpers (Plug-Ins). A helper application is a program that
can be launched by the browser to help. The helper applications are also called Plug-Ins.
Plug-Ins
The plug-ins are used to display maps, to verify the bank id, to control the input, and much more.
The purpose of the <embed> tag is to embed multimedia elements in HTML pages.
<embed>
HTML
Multimedia (object)
<html>
<body>
<object width="400" height="40"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
<param name="SRC" value="stars.swf">
<embed src="stars.swf" width="400" height="500"></embed>
</object>
</body>
</html>
Code Example
Playing flash video file
HTML
Multimedia (object)
Code Example
Playing WMV Movie file Using Windows Media Player
<html>
<body>
<object width="100%" height="100%"
type="video/x-ms-asf" url="3d.wmv" data="3d.wmv"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="3d.wmv">
<param name="filename" value="3d.wmv">
<param name="autostart" value="1">
<param name="uiMode" value="full"><param name="autosize" value="1">
<param name="playcount" value="1">
<embed type="application/x-mplayer2" src="3d.wmv" width="100%" height="100%" autostart="true"
showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
</object>
</body>
</html>
HTML
Multimedia
Playing Videos in HTML
<html>
<body>
<video width="320" height="240" controls="controls" autoplay="autoplay">
<source src="movie.ogg" type="video/ogg">
<source src="movie.mp4" type="video/mp4">
<source src="movie.webm" type="video/webm">
<object data="movie.mp4" width="320" height="240">
<embed width="320" height="240" src="movie.swf">
</object>
</video>
</body>
</html>
Code Example
HTML
Multimedia
Playing Youtube video in HTML
Code Example
In-order to display display a video in a web page, upload the video to YouTube and insert HTML
code to display the video in web page.
YouTube iFrame
<html>
<body>
<iframe width="420" height="345“ src="http://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>
</body>
</html>
YouTube Embedded
<html>
<body>
<embed width="420" height="345“ src=http://www.youtube.com/v/XGSy3_Czz8k type="application/x-
shockwave-flash">
</embed>
</body>
</html>
Code Example
HTML
Meta Tags
HTML meta tags are page data tags that lie between the open and closing head tags in the HTML
code of a document. The text in these tags is not displayed, but parsable and tells the browsers
specific information about the page.
< head>
< title>my institute< /title>
< meta name="description" content=“institute is an Engineering Educational Institute”>
< meta name=“keyword“= content=“Engineering, Education, Science, multan, pakistan,
B.Sc, Computer, Electronic, Chemical, Science, Mathematics, Physics, Chemistry“>
< /head>
HTML
Redirection
URL redirection/ URL forwarding, is a World Wide Web technique for making a web page
available under more than one URL address. When a web browser attempts to open a URL that has
been redirected, a page with a different URL is opened.
<html>
<head>
<meta http-equiv="Refresh" content="5;url=http://www.kaims.edu.pk"></head>
<body>
<h1>Sorry! We have moved!</h1>
<h2>The new URL is: <a href="http://www.kaims.edu.pk">http://www.kaims.edu.pk</a></h2>
<p>You will be redirected to the new address in five seconds.</p>
<p>If you see this message for more than 5 seconds, please click on the link above!</p>
</body>
</html>
Code Example
THE END

Weitere ähnliche Inhalte

Was ist angesagt?

Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
club23
 
Ms access notes
Ms access notesMs access notes
Ms access notes
IKIARA
 
Html basics 7 table
Html basics 7 tableHtml basics 7 table
Html basics 7 table
H K
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
Aram SE
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
jigeno
 
Access presentation
Access presentationAccess presentation
Access presentation
DUSPviz
 
Lession 4 the tables of a database
Lession 4 the tables of a databaseLession 4 the tables of a database
Lession 4 the tables of a database
Đỗ Đức Hùng
 

Was ist angesagt? (19)

Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab File
 
Html
HtmlHtml
Html
 
Sql
SqlSql
Sql
 
Access 2007 lecture notes students
Access 2007 lecture notes studentsAccess 2007 lecture notes students
Access 2007 lecture notes students
 
Basic Access Notes
Basic Access NotesBasic Access Notes
Basic Access Notes
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
Access lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAccess lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access Basics
 
Ms access notes
Ms access notesMs access notes
Ms access notes
 
Html basics 7 table
Html basics 7 tableHtml basics 7 table
Html basics 7 table
 
Sql1
Sql1Sql1
Sql1
 
Microsoft Access Notes 2007 Ecdl
Microsoft Access Notes 2007 EcdlMicrosoft Access Notes 2007 Ecdl
Microsoft Access Notes 2007 Ecdl
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
 
PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
 
Nota ms access 2007
Nota ms access 2007Nota ms access 2007
Nota ms access 2007
 
Access presentation
Access presentationAccess presentation
Access presentation
 
Access chapter 1
Access chapter 1Access chapter 1
Access chapter 1
 
Lession 4 the tables of a database
Lession 4 the tables of a databaseLession 4 the tables of a database
Lession 4 the tables of a database
 
Access 2007
Access 2007Access 2007
Access 2007
 

Ähnlich wie Lect# 1 html part ii

Html - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik AcademyHtml - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik Academy
Ognyan Penkov
 

Ähnlich wie Lect# 1 html part ii (20)

HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
 
Html - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik AcademyHtml - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik Academy
 
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II  Html 5 Tables, Forms and MediaFYBSC IT Web Programming Unit II  Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
 
Html&css lesson 2
Html&css lesson 2Html&css lesson 2
Html&css lesson 2
 
Tables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptxTables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptx
 
Intodcution to Html
Intodcution to HtmlIntodcution to Html
Intodcution to Html
 
Html and css
Html and cssHtml and css
Html and css
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
Practicals it
Practicals itPracticals it
Practicals it
 
PPT-203105353-1.pdf
PPT-203105353-1.pdfPPT-203105353-1.pdf
PPT-203105353-1.pdf
 
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
RDBMS oracle function RDBMSRDBMSRDBMS.pptxRDBMS oracle function RDBMSRDBMSRDBMS.pptx
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
 
Unit 1wt
Unit 1wtUnit 1wt
Unit 1wt
 
Unit 1wt
Unit 1wtUnit 1wt
Unit 1wt
 
table html web programing
table  html  web programingtable  html  web programing
table html web programing
 
Html Table
Html TableHtml Table
Html Table
 
HTML Tutorials
HTML TutorialsHTML Tutorials
HTML Tutorials
 
INTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptxINTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptx
 
Unit 2
Unit 2 Unit 2
Unit 2
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
HTML
HTML HTML
HTML
 

Kürzlich hochgeladen

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Lect# 1 html part ii

  • 1. WEB ENGINEERING Course Code CSI-654 Hypertext Markup Language (HTML) Part-II
  • 2. HTML Table HTML tables enable to effectively present large amounts of data in rows and columns. Table Structure A table is basically a rectangle containing rows and columns. The places where the columns and rows intersect are called cells. Each cell can hold Web page content. Cell Spanning Cells can span two or more columns or rows to form bigger containers for data. For example, a table may include a title cell at the top that spans multiple columns across the table, or one that extends downward across several rows. Tables are defined with the <table> tag. A table is divided into rows with the <tr> tag, and each row is divided into data cells with the <td> tag. The <td> stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc. Table Elements
  • 3. HTML Table <html> <body> <table border="1"> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> </body> </html> <html> <body> <table border="3"bordercolor=#0033CC> <tr> <th>My Class</th> <th>My KAIMS</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> </body> </html>
  • 5. HTML Table (Extend Cells across Columns and Rows) A larger cell in a table can be create by extending the cell across two or more columns or rows. The ability to span cells, also called merging cells. Consider the tag for the cell to extend across columns. Type COLSPAN=“?”, OR ROWSPAN=“?” replacing ? with the number of columns to span. Code Example…
  • 6. HTML Table (Cell Padding and Spacing) Padding to add space between the border and the contents of a cell, while spacing is used to increase the border size or distance between cells. Padding and spacing size is measured in pixels. In the <TABLE> tag, type CELLPADDING=”? ”, replace ? with the pixel value <html> <body> <h4>Table border with cellpadding:</h4> <table border="1" cellpadding=10> <tr> <td>one</td> <td>two</td> </tr> <tr> <td>three</td> <td>four</td> </tr> </table> </body> </html>
  • 7. HTML Table (Cell Padding and Spacing) In the <TABLE> tag, type CELLSPACING=”? ”, replace ? with the pixel value <html> <body> <h4>Table border with cellpadding:</h4> <table border="1" cellspacing=10> <tr> <td>one</td> <td>two</td> </tr> <tr> <td>three</td> <td>four</td> </tr> </table> </body> </html>
  • 8. HTML Table (Tags inside a table) Code Example…
  • 9. HTML Table (Cell Width and Height) A cell’s width can be control using the WIDTH attribute and its height using the HEIGHT attribute. This enables to allocate more space to columns or rows that have more content. If a specific width or height is not set, the content of the cell determines the cell’s size. In the <TD> tag, type WIDTH=”?”, replacing ? with the value or percentage to set the cell. <html> <body> <h4>Table Cell Width and Height</h4> <table border="1"> <tr><td width=100>one</td> <td>two</td> </tr> <tr> <td height=120>three</td> <td>four</td> </tr> </table> </body> </html>
  • 10. HTML Table (Column Header) Type <TH> after the <TR> tag for the row to use as column labels. <html> <body> <h4>Table with Column Header/ Label</h4> <table border="1"> <tr> <th>Name</th> <td>City</td> <td>Country</td> </tr> <tr> <td>Kazim</td> <td>multan</td> <td>Pakistan</td> </tr> </table> </body> </html>
  • 11. HTML Table (Insert background image) <html> <title>Table background image</title> <body> <h4>A background image</h4> <table border="1" background="table-background.jpg"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> </body> </html> Code Example…
  • 12. HTML Table (Add a background color or a background image to a table cell) <html> <body> <h4>Cell backgrounds:</h4> <table border="1"> <tr> <td bgcolor="green">First</td> <td>second</td> </tr> <tr><td> < background="table-background.jpg"> third</td> <td>fourth</td> </tr> </table> </body> </html>
  • 13. HTML Table (Align the content in a table cell) Code Example…
  • 14. HTML Table (Newspaper Style Columns) The table format may be used to present columns of text on Web page, much like a newspaper. The text may be organize into two or three columns. Paragraphs of text are contained within each column. The vertical alignment attribute to make each column align at the top of the table. Within the <TR> and </TR> tags, type <TD VALIGN=”top”> to start the first column of text. Code Example…
  • 15. HTML Forms A form allows a user to enter data that is sent to a server for processing. It is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. The most important form element is the input element. It is used to select user information. It can vary in many ways, depending on the type attribute and can be of type text field, checkbox, password, radio button, submit button, and more. The <form> tag is used to create an HTML form <form> . input elements . </form>
  • 16. HTML Forms (Text Fields) <html> <body> <form action=“ "> First name: <input type="text" name="firstname"><br> Last name: <input type="text" name="lastname"> </form> </body> </html> (password Field) <form action=""> Username: <input type="text" name="user"><br> Password: <input type="password" name="password"> </form>
  • 17. HTML Forms (Check Boxes) <form action=""> <input type="checkbox" name="myclass" value="Web">Web Engineering<br> <input type="checkbox" name="myclass" value="pm">Project Management </form> (Radio buttons) <form action=""> <input type="radio" name=“myradio" value="male">Male<br> <input type="radio" name=“myradio" value="female">Female </form>
  • 18. HTML Forms (Drop-down list simple) (Drop-down list with a pre-selected value) <form action=""> <select name="subject"> <option value="web">Web Engineering</option> <option value="pm">Project Management</option> <option value="c++">C++</option> <option value="java">Java</option> </select></form> <form action=""> <select name="subject"> <option value="web">Web Engineering</option> <option value="pm">Project Management</option> <option value="c++">C++</option> <option value="java">Java</option> <option value="DE" selected="select">Digital Electronic</option> <option value="DSP">Digital Signal Processing</option> </select></form>
  • 19. HTML Forms (Textarea multi-line text input field) <html> <body> <textarea rows="10" cols="30"> A friend is someone who is there for you when he'd rather be somewhere else. Only your real friends tell you when your face is dirty. </textarea> </body> </html>
  • 20. HTML Forms (Button) <form action=""> <input type="button" value=“Welcome"> </form> Border around form-data (fieldset) <form action=""> <fieldset> <myborder>Personal information:</myborder> Name: <input type="text" size="30"><br> E-mail: <input type="text" size="30"><br> Date of birth: <input type="text" size="10"> </fieldset></form>
  • 21. HTML Forms (GET and POST method) GET method The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute). The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post"). <form name="myform" action="myform.aspx" method="get"> First name: <input type="text" name="FirstName" value="Nasir"><br> Last name: <input type="text" name="LastName" value="Qasim"><br> <input type="submit" value="Submit"> </form> When Submit button is clicked, the form-data will be sent to a page myform.aspx Code Example…
  • 22. HTML Forms (GET and POST method) GET method <form name="input" action="myform.aspx" method="get"> <input type="checkbox" name="myclass" value="web">Web Engineering<br> <input type="checkbox" name="myclass" value="pm">Project Management <br><br> <input type="submit" value="Submit"> </form> Code Example… Radio buttonsand submit button <form name="input" action="myform.aspx" method="get"> <input type="radio" name="mychoice" value="male">Male<br> <input type="radio" name="mychoice" value="female">Female<br> <input type="submit" value="Submit"> </form> Code Example…
  • 23. HTML Forms (GET and POST method) POST method The POST request method is used when the client needs to send data to the server as part of the request (behind the scenes), such as when uploading a file or submitting a completed form. <form action=“mailto:info@kaims.edu.pk" method="post" enctype="text/plain"> Name:<br> <input type="text" name="myname" value="your name..."><br> E-mail:<br> <input type="text" name="mymail" value="your email..."><br> Comment:<br> <input type="text" name="mycomment" value="please leave your comments...." size="50"><br><br> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form> Code Example…
  • 24. HTML Layout The webpage layout follows a certain basic design structure. <div> Elements It is a block level element used for grouping HTML elements. Multiple columns are created by using <div> or <table> elements
  • 25. HTML Layout <div> Elements It is a block level element used for grouping HTML elements. Multiple columns are created by using <div> or <table> elements Code Example using div Code Example using table
  • 26. HTML Frame Frames allow for multiple .html documents to be displayed inside of one browser window at a time. Frames can divide the screen into separate windows.
  • 27. HTML Frame (frameset) <html> <frameset rows="50%,50%"> <frame src="header.htm"> <frameset cols="18%,82%"> <frame src="menu.htm"> <frame src="main.htm"> </frameset> </frameset> </html> Code Example
  • 28. HTML Iframe (Inline frame) It is used to display the embedded data inside a sub window of the browser's window. Code Example
  • 29. HTML Multimedia Multimedia on the web is sound, music, videos, and animations. Multimedia comes in many different formats. It can be almost anything, hear or see like text, pictures, music, sound, videos, records, films, animations, and more. Multimedia elements (like sounds or videos) are stored in media files. The most common way to discover the media type is to look at the file extension. Object The <object> element supports the HTML helpers (Plug-Ins). A helper application is a program that can be launched by the browser to help. The helper applications are also called Plug-Ins. Plug-Ins The plug-ins are used to display maps, to verify the bank id, to control the input, and much more. The purpose of the <embed> tag is to embed multimedia elements in HTML pages. <embed>
  • 30. HTML Multimedia (object) <html> <body> <object width="400" height="40" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"> <param name="SRC" value="stars.swf"> <embed src="stars.swf" width="400" height="500"></embed> </object> </body> </html> Code Example Playing flash video file
  • 31. HTML Multimedia (object) Code Example Playing WMV Movie file Using Windows Media Player <html> <body> <object width="100%" height="100%" type="video/x-ms-asf" url="3d.wmv" data="3d.wmv" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> <param name="url" value="3d.wmv"> <param name="filename" value="3d.wmv"> <param name="autostart" value="1"> <param name="uiMode" value="full"><param name="autosize" value="1"> <param name="playcount" value="1"> <embed type="application/x-mplayer2" src="3d.wmv" width="100%" height="100%" autostart="true" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed> </object> </body> </html>
  • 32. HTML Multimedia Playing Videos in HTML <html> <body> <video width="320" height="240" controls="controls" autoplay="autoplay"> <source src="movie.ogg" type="video/ogg"> <source src="movie.mp4" type="video/mp4"> <source src="movie.webm" type="video/webm"> <object data="movie.mp4" width="320" height="240"> <embed width="320" height="240" src="movie.swf"> </object> </video> </body> </html> Code Example
  • 33. HTML Multimedia Playing Youtube video in HTML Code Example In-order to display display a video in a web page, upload the video to YouTube and insert HTML code to display the video in web page. YouTube iFrame <html> <body> <iframe width="420" height="345“ src="http://www.youtube.com/embed/XGSy3_Czz8k"> </iframe> </body> </html> YouTube Embedded <html> <body> <embed width="420" height="345“ src=http://www.youtube.com/v/XGSy3_Czz8k type="application/x- shockwave-flash"> </embed> </body> </html> Code Example
  • 34. HTML Meta Tags HTML meta tags are page data tags that lie between the open and closing head tags in the HTML code of a document. The text in these tags is not displayed, but parsable and tells the browsers specific information about the page. < head> < title>my institute< /title> < meta name="description" content=“institute is an Engineering Educational Institute”> < meta name=“keyword“= content=“Engineering, Education, Science, multan, pakistan, B.Sc, Computer, Electronic, Chemical, Science, Mathematics, Physics, Chemistry“> < /head>
  • 35. HTML Redirection URL redirection/ URL forwarding, is a World Wide Web technique for making a web page available under more than one URL address. When a web browser attempts to open a URL that has been redirected, a page with a different URL is opened. <html> <head> <meta http-equiv="Refresh" content="5;url=http://www.kaims.edu.pk"></head> <body> <h1>Sorry! We have moved!</h1> <h2>The new URL is: <a href="http://www.kaims.edu.pk">http://www.kaims.edu.pk</a></h2> <p>You will be redirected to the new address in five seconds.</p> <p>If you see this message for more than 5 seconds, please click on the link above!</p> </body> </html> Code Example