Page 60 - PortGPT_V2.1_C8_Flipbook
P. 60
Padding Property
We use padding to add space between the border and the contents of a cell. We can use spacing to
increase the border size or distance between cells. Since the table contents are present in <TH> and
<TD>, the padding property is declared for these two elements in the style tag.
Property Value Description
It specifies the space between cell
Length
contents in cm, px, or pts.
Padding It specifies the space between the cell
% contents in percentage of the element
in which it is used.
Write HTML code to add space between contents of cell and the border.
<!DOCTYPE html>
<HTML>
<HEAD><TITLE>A Simple Table Structure</TITLE>
<STYLE>
TABLE,Th,Td
{
Border:2px solid black;
Border -collapse:collapse;
}
TH, TD
{
padding: 30px;
}
</STYLE>
</HEAD>
<BODY>
<TABLE>
<CAPTION>STUDENT'S DETAILS</CAPTION>
<TR>
<TH>ADMISSION</TH>
<TH>NAME</TH>
<TH>TOTAL MARKS</TH>
</TR>
<TR>
<TD>2016/0256</TD>
<TD>Aadya Kaushal</TD>
58 Premium Edition-VIII

