Skip to main content

Difference between Cellspacing and Cellpadding



Cellspacing and Cellpadding are two important attributes of  <Table> tag. As you know <Table> tag is used to create and display tables in HTML documents.

What is CELLSPACING?

Cellspacing is an important attribute of <Table> tag in HTML. Cellspacing specifies the spacing between adjacent cells in a table. Consider the following example of an HTML table with cellspacing attribute set to 50.

Example of Cellspacing use

<TABLE border="1" cellspacing="30">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

Example of Cellspacing=15

<TABLE border="1" cellspacing="15">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

Example of Cellspacing=0

<TABLE border="1" cellspacing="0">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

What is CellPadding?

Cellpadding is used to specify the distance between a cell contents and its boundaries. For example, consider the following table with cellpadding=0

Example of Cellpadding=0

<TABLE border="1" cellpadding="0">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

Example of Cellpadding=20

<TABLE border="1" cellpadding="20">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

Example of Cellpadding=50

<TABLE border="1" cellpadding="50">
<th>Name</th><th>Marks</th>
<tr><td>Sajid Mahmood</td><td>666</td>
<tr><td>Majid Karim</td><td>555</td>
</table>

NameMarks
Sajid Mahmood666
Majid Karim555

Comments

Popular posts from this blog

What are Different Types of Input Devices With Examples

Topic: Different types of input devices of a computer system with examples, pictures and explanation:  Topics Covered are: Definition of Input Devices Functions of Input Devices ( How input devices work? ) Examples of Input Devices Pictures / Images of different input devices Different Examples of Input Devices With Description Keybboard Mouse Trach Ball Trackpad Joy Stick Light Pen Microphone Scanner Graphic Tablet ( Digitizer ) Digital Camera Touch Screen ( I/O Device / Dual Device - Perform Both Functions input + Output ) INPUT DEVICES ( Definition ) Input devices are used to enter data and instructions into computer memory from external world. Input Device is a hardware part of the computer that is used to enter data and instructions into computer memory. The examples of input devices include: Keyboard, Mouse , Track ball, Track Pad, Joy stick, Touch Screen, Light pen,   Scanner , Digital Camera, Microphone, Graphics tablet e...

Basic Structure of HTML Document

Basic Structure of HTML Document  The basic structure of an HTML document is given below: <HTML>         <HEAD>                  </HEAD>                 <BODY>                </BODY> </HTML> The above format shows that an HTML document starts with <HTML> tag and ends with </HTML> tag. It is also clear that an HTML document consists of two main sections:  Head Section Head section is used to specify a title of the web page, normally. There are some other uses of Head section too, like linking external style sheets and Java script code, etc. Head section starts with the <HEAD> tag and ends with the </HEAD> tag. <TITLE> tag is used to display a title of...

Types Of Network Topology

Today, we will types of network topology . What is a Network Topology? Definition of Network topology is the shape of the network . It is the physical layout of connected devices in a network. It tells us how a network will look like. Network Topology ( Definition 2) : The way in which the connections are made among all the network entities is called the topology of the network. Network Topology ( Definition 3) :Network topology specifically refers to the physical layout of the network, e.g., the location of the computers and how the cable is run between them. Network Topology ( Definition 4) :The physical topology of a network refers to the configuration of cables, computers, and other peripherals. The characteristics of a network depend upon the network topology selected. types of network topology Explain different types of network Topology Different network topologies are as follows: 1. Bus Topology 2. Ring Topology 3. Star Topology 4. Tree Topolo...