HTML Part 4: Attributes of Table Tag and Rowspan and Colspan in Table

Get unlimited access to the best preparation resource for UGC : Get detailed illustrated notes covering entire syllabus: point-by-point for high retention.

Discussion on HTML

  • <TABLE> TAG

  • Rowspan & Colspan

  • To Insert Image

  • <FRAME> TAG

  • <EMBED> TAG

<Table> Tag

  • A Table helps to arrange data in the form of rows and columns. In HTML, <table> tag is used to create table.

  • In HTML, A table element can contain another <table> element, <TR>, <TD> and <TH>.

  • <TR> element defines a table row, <TD> defines a table cell and <TH> defines the table header.

To Understand the Html Code for Creating Table, See the Following Image:

Table Tag

Table Tag

Loading image

Attributes of Table Tag

Attributes of Table Tag

Attributes of Table Tag

Loading image

Code/Output

Code/Output

Code/Output

Loading image

Rowspan and Colspan in Table

  • Rowspan- This attribute of <td> tag specifies the number of rows; a cell should span. For Example, <td Rowspan= “4”> means, this cell will take the space of four rows.

  • Colspan- This attribute of <td> tag specifies the number of columns; a cell should span. For Example, <td Colspan= “4”> means, this cell will take space of four columns.

To Understand the Topic, Look at The Following Table:

Rowspan and Colspan in Table

Rowspan and Colspan in Table

Loading image

Code/Output

Code/Output

Code/Output

Loading image

To Insert an Image

<IMG> tag is used to set an image on the webpage.

Attributes of an Image Tag

  • SRC= It specifies the image url.

  • ATL= It specifies an alternate text for the image. If for some reason the image cannot be displayed, the alternate text is appearing.

  • WIDTH= It specifies the width of the image.

  • HEIGHT= It specifies the height of the image.

Html Code to Set an Image

<img src= “aeroplane.jpg” alt= “Image of an aeroplane” height= “200” width= “200”>

Code/Output

Code/Output

Code/Output

Loading image

<Frameset> Tag

  • <FRAMESET> tag divide a web page window into multiple sections called frames. Each frame can have different HTML web page.

  • Another tag called <FRAME> is also used with <FRAMESET> tag. <FRAME> tag specifies the HTML web page whereas <FRAMESET> specifies the layout of the section.

Attribute of <Frameset> Tag

  • rows- It defines the horizontal frame of a specific height.

  • Cols- It defines the vertical frame of a specific width.

Html Code

  • <body>

  • <frameset cols= “70%, 30%”> <! – creating vertical frames ---- >

  • <frame url= “www.google.com”>

  • <frame url= “www.yahoo.com”>

  • </frameset>

  • </body>

Note: <FRAME> tag is not supported in HTML5. We can create frames using <iframe > also

Output

Google: Output

Google: Output

Loading image

<Iframe> Tag

<iframe> tag is used to divide a window into multiple frames. Each frame can have different HTML document.

Html Code

  • <body>

  • <iframe src= “home.html” height= “400” width= “500” scrolling= “yes”>

  • </iframe>

  • </body>

Note: <iframe> tag is not supported by some web browser.

<Embed> Tag

<Embed> tag defines container for an external resource like audio, video, any picture, or any web page.

HTML Code to Embed an Audio File

<embed src=“audio.mp3”>

HTML Code to embed a Audio File

HTML Code to Embed a Audio File

Loading image

HTML Code to Embed a Video File

<embed type=“video/webm” src= “movie.mp4” width= “500” height= “400”>

HTML Code to embed a Video File

HTML Code to Embed a Video File

Loading image

MCQ

Q.-1 Which HTML tag is used to divide a web page into multiple section, where each section can contain different Web Page?

1. <BORDER>

2. <TABLE>

3. <FRAMESET>

4. <IMG>

Ans: 3. <FRAMESET>

Q.-2 Cells pacing and Cellpadding are the attributes of _______ tag.

1. <IMG>

2. <FRAME>

3. <DIV>

4. <TABLE>

Ans: 4. <TABLE>