HTML table tag

We can create a table in html by using <htmt></htmt> tag.
with in table tag we use <tr> to create new table row.
inside tr we use <td> tag to specify data value.
to provide table header <th> tag is used

One table can contain multiple table rows and each row can contain multiple table data.

Syntax

<th> is optional it is used to provide HTML Table with Header

Example

Sr NoNameCity
1ManishBhilai
1MohanBhopal
1RamBanglore

For providing data heading we use <th> tag

HTML Table with border

In above table we have not provided table border to provide HTML table with border we can use border attribute with border tag as below

table border=" 1|0"

0 specify no border around the table
1 specify border around the table

HTML Border attribute in not support by HTML 5.

Insted of border attribute use CSS.

User NameMailid
Ram[email protected]
Mohan[email protected]
Shyam[email protected]

HTML Table border with CSS

HTML Table With Caption

To provide table caption <caption> tag is used is should be used below the <table> tag

User Name and Mailid details of user
User NameMailid
Ram[email protected]
Mohan[email protected]
Shyam[email protected]

HTML Table Grouping Tag

<thead>, <tbody> and <tfooter> tags are used for grouping table rows <thead> is used to group table header


<tbody> is used to group table body
<tfooter is used to group table footer

Q Which tag allows you to add a row in a table?

tr rag allows us to add a row in a table

Q Can a data cell contain images in html

yes We can include images in HTML data cell

Q what is the use of “border ” attribute of table tag?

“border ” attribute of table tag is used to set table border

HTML Image tag

Including an image in html requires use of <img> tag. To display an image we have to give image path in src attribute image path can be path of image storage in local system or it can be a url.

Syntax

img tag uses following few attributes

  1. src: This attribute is compulsory it provide path to image(including image name with extension). path may be either url or path of image in directory if image is in same directory where your htlm page is then you have to give image name with extension only.
  2. alt: It provides alter native text for image. If image is not loaded then browser will display this text message.
  3. width: We can set the width of image either in pixel value or % wise.
  4. height: We can set the height of image either in pixel value or % wise.

Tag

Example:

img with alt attribute

img with alt, width & height attribute

Output:

Image

Image

Image

HTML Anchor tag

Anchor tag is used to create hyperlink in web page.
We can provide a hyperlink to give a option to user to redirect or open new page on same or on another window.

Here href attribute value is a url or path of next page where you want to redirect or open the page

Tag

Example

Output

Go to Ebhor main page

If you want to know how to open a page in new window then click here

HTML Paragraph tag

This tag is used to write paragraph in html document.

Tag

Example

Output:

Hello how are you

This is a good book

HTML Heading Tags

We use six tags for Heading
These are

font size decreses from <h1> to <h6>

Example

Output

This is h1 heading

This is h2 heading

This is h3 heading

This is h4 heading

This is h5 heading
This is h6 heading

We can use these tags to give appropriete heading in web page.

These tags are used to create different level of header in web page.