Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying padding to the head of table

Tags:

html

css

Is there any way i can set padding to the thead alone of a table?

like image 665
ssri Avatar asked Dec 14 '10 05:12

ssri


People also ask

How do you apply table padding?

To set cell padding in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property padding.

Can we give padding to table in HTML?

HTML tables can adjust the padding inside the cells, and also the space between the cells.

What does the padding CSS property do for a table?

The CSS padding properties are used to generate space around an element's content, inside of any defined borders. With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).

Can I put padding on TR?

You can't add padding or margins to a 'tr' they are simply a mechanism to separate cells into rows.


2 Answers

table th
{
padding:15px;
}
like image 191
Bhanu Prakash Pandey Avatar answered Sep 27 '22 20:09

Bhanu Prakash Pandey


<table>
    <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Savings</th>
    </tr>
    <tr>
        <td>Jhon</td>
        <td>Smith</td>
        <td>$200</td>
    </tr>
</table>

<style>
    table, td, th { border : 1px solid black; }
    th { padding : 13px; }
    td { padding : 15px; }
</style>
like image 33
pooja Avatar answered Sep 27 '22 18:09

pooja