TABLES AND LINKS IN HTML CLASS VIII
A. Multiple Choice Questions
1. Which of the following is not an attribute of <a> tag?
Answer: c. SRC
Explanation: The anchor tag (
<a>) uses attributes likehrefand global attributes liketitle. Thesrc(orSRC) attribute is used to specify the source file for elements like<img>,<script>, or<iframe>, making it incorrect for the<a>tag.
2. Which attribute specifies the space between the cells?
Answer: b. Cell-spacing
Explanation: In HTML tables, the
cellspacingattribute defines the space between adjacent cells, while attributes likerowspanandcolspanmanage cell merging, and padding manages the space inside a cell. 3. Which of the following can be used as a hyperlink?
Answer: d. All of the options
Explanation: Text, images, and buttons can all be turned into or used as hyperlinks in HTML.
4. Which attribute of table allows you to provide the table heading?
Answer: c.
<Caption>Explanation: The
<caption>tag is used to add a title or heading to a table.
5. Which property of a table allows you to maintain a single border for the entire table?
Answer: b. Collapse
Explanation: The
border-collapse: collapse;CSS property collapses cell borders into a single border.
B. Fill in the blanks
<caption>attribute of<table>specifies the caption for the table. (Note: In HTML, <caption>is technically a tag, but commonly referred to in school curricula for table titles).hrefandtarget(ortitle) are the attributes of<a>tag. Hyperlink (or URL) is used to connect webpages on WWW
. valign(Vertical) alignment has three options: top, bottom and middle. Internal and External are the two types of linking
.
C. State True or False
SRC is the attribute of
<a>tag in HTML.Answer: False (SRC is used for
<img>,<script>, etc.;<a>useshref).
You can add an image as the background of a table.
Answer: True (Can be achieved using CSS
background-image).
HTML allows you to specify different colours for both table data and table headings.
Answer: True (Styles can be applied independently to
<th>and<td>elements).
Padding enables you to specify the space between the border of a cell and its contents.
Answer: True (Cell padding controls the internal spacing of a cell).
To define the style for an unvisited link, a:active link is used.
Answer: False (An unvisited link uses
a:link, whereasa:activeis for an active/clicked link).D. Write CSS codes for the following
1. To set the width of a table to 100% and the height to 80px:
CSStable {width: 100%;height: 80px;}```2. To set the space of 5px between the cell border and cell contents:
CSStd, th {padding: 5px;}```3. To set the vertical alignment of the
<td>to middle:CSStd {vertical-align: middle;}```4. To set the border thickness to 8px and border colour to red:
CSStable, th, td {border: 8px solid red;}```5. To set the colour of the active link to red:
CSSa:active {color: red;}```
E. Answer the following questions
1. Define table:
A table is a structured arrangement of data organized in rows and columns
. In HTML, it is created using the
<table>tag to present information clearly.
2. Name the different attributes of
<table>tag:Common attributes include
border,width,height,cellspacing,cellpadding, andbgcolor.
3. What is the usage of
<caption>tag?The
<caption>tag is used to specify a title or descriptive heading for a table.
4. What is the significance of
<a>tag?The
<a>(anchor) tag is essential for creating hyperlinksIt allows users to connect and navigate between different webpages or resources on the World Wide Web
5. Name two different types of table alignments:
Horizontal alignment (left, center, or right)
Vertical alignment (top, middle, or bottom)
6. Write the various attributes of
<a>tag:href: Specifies the URL or destination address of the link.
target: Specifies where to open the linked document (e.g.,
_blankopens it in a new window/tab).title: Provides extra advisory information about the link, usually displayed as a tooltip.
download: Indicates that the target will be downloaded when the user clicks the hyperlink.
7. What is the difference between border-spacing and border-padding?:
border-spacing: Specifies the distance or space between the borders of adjacent cells in a table.
padding(commonly referred to in school texts as cell padding): Specifies the space between the border of an individual cell and its inner contents. (Note: Standard CSS usespaddingrather thanborder-padding).
8. What are the different attributes of linking in HTML?:
href: Defines the link destination.
target: Defines the browsing context/window where the link opens.
title: Adds descriptive tooltip text.
rel: Defines the relationship between the current document and the linked resource.
9. Write the steps to create a link using an image:
Step 1: Open your HTML file and type the opening anchor tag with the
hrefattribute (<a href="url">).Step 2: Immediately inside the anchor tag, place the image tag with its source attribute (
<img src="image-name.jpg" alt="Description">).Step 3: Close the anchor tag (
</a>).Example:
<a href="[https://www.example.com](https://www.example.com)"><img src="logo.png" alt="Website Logo"></a>
10. What is the difference between rowspan and colspan?:
rowspan: Allows a table cell to span across multiple rows vertically.
colspan: Allows a table cell to span across multiple columns horizontally.
Comments
Post a Comment