HTML Assignment - Answers
Short Questions:
1. What is the <caption> tag?
The <caption> tag is used to provide a title or a description for a <table> element. It is placed
directly after the <table> tag.
2. Differentiate cellpadding and cellspacing.
cellpadding: It is the space between the content of a cell and the cell's border. It is used within the
<table> tag.
cellspacing: It is the space between the individual cells in a table. It is used to set the spacing
between the borders of adjacent cells.
3. Define colspan and rowspan.
colspan: It specifies the number of columns a cell should span in a table.
rowspan: It specifies the number of rows a cell should span in a table.
4. What is the <colgroup> tag?
The <colgroup> tag is used to group one or more <col> tags. It is used to apply styles or properties
to entire columns in a table.
5. Explain target attributes.
The target attribute specifies where to open the linked document. It can have values like:
_blank: Opens the link in a new tab.
_self: Opens the link in the same tab (default).
_parent: Opens the link in the parent frame.
_top: Opens the link in the full body of the window.
6. Differentiate GET and POST method.
GET: Sends data in the URL and is used to request data from a server. It is visible to the user and
limited in size.
POST: Sends data as part of the HTTP request body and is used to submit data to the server. It is
not visible in the URL and has a higher capacity.
7. List tags used to create a table.
<table>, <tr>, <td>, <th>, <caption>, <colgroup>, <thead>, <tbody>, <tfoot>.
8. Explain <textarea> tag.
The <textarea> tag is used to create a multi-line text input field where users can enter longer text. It
is typically used in forms.
Long Questions:
1. Explain <table> tag with all its sub-tags.
The <table> tag is used to define a table. Its sub-tags include:
<tr>: Defines a row in a table.
<td>: Defines a cell in a table.
<th>: Defines a header cell in a table.
<caption>: Adds a title or description to the table.
<colgroup>: Defines a group of columns for styling or other purposes.
<thead>, <tbody>, <tfoot>: Define the header, body, and footer sections of a table respectively.
2. Explain table level, row level, and cell level attributes.
Table-level attributes: Attributes like border, cellspacing, cellpadding that apply to the entire table.
Row-level attributes: Attributes like align, bgcolor that apply to a specific row (<tr>).
Cell-level attributes: Attributes like rowspan, colspan, align, valign that apply to individual cells (<td>
or <th>).
3. Explain HTML table with a <thead>, <tbody>, and <tfoot> elements.
The <thead> section contains the header rows, which typically have column titles.
The <tbody> section contains the data rows of the table.
The <tfoot> section contains the footer rows, often used for totals or summary information.
4. How do we define a bookmark in a webpage? Explain with an example.
A bookmark, or anchor link, is created using the <a> tag with the href attribute. It can point to a
specific location within the same page or a different page. Example:
<a href="#section1">Go to Section 1</a>
<div id="section1">This is Section 1</div>
5. Write HTML code to design an email registration form.
<form action="submit_email.php" method="post">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<input type="submit" value="Register">
</form>
6. Write a note on Forms.
Forms are used to collect user input on a webpage. They can include input fields, buttons, and other
controls. Data from forms can be submitted to a server using methods like GET or POST.
7. Explain <input> tag. Explain various elements of the type attribute.
The <input> tag is used to create interactive controls in a form, allowing users to enter data. The
type attribute specifies the kind of input element:
text: Single-line text input.
password: Password input, hides the entered text.
radio: Radio button for selecting a single option from a group.
checkbox: Checkbox for selecting multiple options.
email: Email input field with validation.
submit: Button to submit the form.