HTML Tables
HTML Tables are very user friendly they are used to display a set of records from database or to create a good look for a form.Table is created using "table" tag and it also has the closing tag.
Table has the attribute of height,width,cellpadding,cellspacing and border.
Height is used to set the height of the table
Width is used to set the width of the table
Cellpadding is the space between the cell and the text of the cell
Cellspacing is the space between adjacent cells
Border is used to set the border of table
Table includes table row and table cell indicated as tr and td.
TH tag is used to define the heading of columns
TR tag is used to start a new row and dislpay the data
TD tag is used to define the data of cell
Example
This results in following table
| Name | Age |
|---|---|
| abc | 22 |
| xyz | 25 |
For every next row the current row has to be closed and new row has to be opened
HTML Forms are used to pass data between client and server
These forms contains input fields like input text box,select box,text area any of these and more.
It is created using form tag with closing form tag as follows
It takes name,method,action as its main parameters
Where name is the name of form,
method is the type of form as post or get
and action is the specified url to perform operations using the inout data
POST is used when data has to be hidden while passing between client and server
GET is used for small amount of data and when get is used the data is visible in the url.
HTML Form Elements
There are many HTML Form Elements as follows
- Input Text Box
- Password Text Field
- Radio Buttons
- Text area
- Checkboxes
- Submit Button
Input Text Box
This is used to get the input of user for name,age or city any data.
This is created as follows
Password Field
This is used to get the password of user.
This is created as follows
Radio Buttons
This is used to display an option for user among choices like male,female etc.
This is created as follows
maleFemale
Check Boxes
This is used to display an option for user among choices yes or no etc.
This is created as follows
YesNo
Submit Button
This is used to submit form data to server to save them to database or manipulate them in any way.
This usedas follows
This is used exclusively with forms which has n nunber of data to be processed.
Text area
This is used to get more data like address etc.
This is created as follows
This takes rows and cols as its attributes where rows is the height of area and cols is the width of area
HTML Lists are used to list the contents in order.
HTML lists are of 3 types Ordered,Unordered,Definition list.
Ordered lists are created using "ol" tag which displays list items in ordered way of numbers.It also has closing tag.each list item is embeded inside opening and closing of "li" tag
The ordered lis may look like the following
- Name
- Age
- Address
which is the output of following code
Unordered lists are created using "ul" tag which displays list items in unordered way of bullets.It also has closing tag.each list item is embeded inside opening and closing of "li" tag
The ordered lis may look like the following
- Name
- Age
- Address
which is the output of following code
The ul tag has following types
disc
square
circle
Definition lists are created using "dl" tag which displays list items as its description.It also has closing tag.each item is embeded inside opening and closing of "dd" tag which is a data description followed by "dt" which defines the item list.
The ordered lis may look like the following
- Fruits
- - apple
- - orange
- Laptops
- - DELL
- - HCL
which is the output of following code
HTML doc allows to use images in the document these images can be any of the .jpeg,.jpg,.gif or .png format.
It uses img as its specification inside the open and <> close tag.
It has the attributes as height,width and also the style can be written for the image.
It has "alt" as its attribute which specifies the alternate text for the image
Example:
Which will results in following
HTML Links are used to link the external file source like html or css files.
These files are specified in the href attribute and are embedded to the executing file.
It includes "rel","type","href" as major three parameters
"rel" indicates the relation of the external file as stylesheet or any other help files which has to be included.
"type" indicates the type of the file as text/css or text/javascript
"href" is the parameter to indicate the file name
Example
It also has the attributes as "target" which can be any of the following
_blank
_self
_top
_parent
frame_name
If _blank is specified it opens the url in new window