Week4 HTMLTableandForm
Week4 HTMLTableandForm
• The HTML tables are created using the <table> tag in which
the <tr> tag is used to create table rows and <td> tag is used
to create data cells. The elements under <td> are regular and
left aligned by default
Tag Description
<table> Defines a table
<th> Defines a header cell in a table
<tr> Defines a row in a table
<td> Defines a cell in a table
<caption> Defines a table caption
<colgroup> Specifies a group of one or more columns in a table for formatting
<col> Specifies column properties for each column within a <colgroup> element
<thead> Groups the header content in a table
<tbody> Groups the body content in a table
<tfoot> Groups the footer content in a table
The Attribute for TABLE
Tag Description
border="?" Thickness of outside border
bordercolor="#??????" Border Color
cellspacing="?" Space between cells (pixels)
cellpadding="?" Space between cell wall and content
align="??" Horizontal Alignment: left, center, right
bgcolor="#??????" Background Colour
width="??" Table Width (pixels or %)
height="??" Table Height (pixels or %)
The Attribute for <td>
Tag Description
border="?" Thickness of outside border
bordercolor="#??????" Border Color
cellspacing="?" Space between cells (pixels)
cellpadding="?" Space between cell wall and content
align="??" Horizontal Alignment: left, center, right
bgcolor="#??????" Background Color
width="??" Table Width (pixels or %)
height="??" Table Height (pixels or %)
bgcolor="#??????" Background Color
align="??" Horizontal Alignment: left, center, right
valign="??" Vertical Alignment: top, middle, bottom
nowrap Force no line breaks in a particular cell
<table>
Here, the border is an attribute of <table> tag and it is used to put a border across all the cells. If you do not
need a border, then you can use border = "0".
HTML Tags
<th>
• Table heading can be defined using <th> tag
• This tag will be put to replace <td> tag, which is used to
represent actual data cell.
• Headings, which are defined in <th> tag are center and bold by
default.
Tag Description
<form> Defines an HTML form for user input
Tag Description
<select> Defines a drop-down list
2. Password input controls − This is also a single-line text input, but it masks the
character as soon as a user enters it. They are also created using HTML <input> tag.
3. Multi-line text input controls − This is used when the user is required to give details
that may be longer than a single sentence. Multi-line input controls are created using
HTML <textarea> tag.
Attribute Description
type Indicates the type of input control and for password input control it will
be set to password. and for text input control it will be set to text
name Used to give a name to the control which is sent to the server to be
recognized and get the value.
value This can be used to provide an initial value inside the control.
Attribute Description
name Used to give a name to the control which is sent to the server
to be recognized and get the value.
rows Indicates the number of rows of text area box.
Attribute Description
Type Indicates the type of input control and for checkbox input control it will
be set to checkbox.
name Used to give a name to the control which is sent to the server to be
recognized and get the value.
value The value that will be used if the checkbox is selected.
Attribute Description
type Indicates the type of input control and for checkbox input control it will
be set to radio.
name Used to give a name to the control which is sent to the server to be
recognized and get the value.
value The value that will be used if the radio box is selected.
Attribute Description
Name Used to give a name to the control which is sent to the server to be
recognized and get the value.
size This can be used to present a scrolling list box.
multiple If set to "multiple" then allows a user to select multiple items from the
menu.
Option
Following is the list of important attributes of <option> tag for Select Box Control
Attribute Description
value The value that will be used if an option in the select box box is selected.
selected Specifies that this option should be the initially selected value when the
page loads.
Attribute Description
name Used to give a name to the control which is sent to the server to be
recognized and get the value.
accept Specifies the types of files that the server accepts.
File Upload
Button Controls
There are various ways in HTML to create clickable buttons. You can also create a clickable button using <input>tag by setting
its type attribute to button.
Atrribute Description
submit This creates a button that automatically submits a form.
reset This creates a button that automatically resets form controls to their initial
values.
button This creates a button that is used to trigger a client-side script when the
user clicks that button.
image This creates a clickable button but we can use an image as background of
the button.
Button
HTML Tags
Hidden Control
Hidden form controls are used to hide data inside the page which later on can be
pushed to the server. This control hides inside the code and does not appear on the
actual page.
For example, following hidden form is being used to keep current page number. When a
user will click next page then the value of hidden control will be sent to the web server
and there it will decide which page will be displayed next based on the passed current
page.