aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Thursday, August 18, 2011 Total Views:  

 

In this example, you will see how to handle table cellpading and cellspacing with css. By default  cellspacing and cellpading added in HTML table.

cellspacing:cellspacing will set the space between the cells

cellpadding:cellpadding will set the space between the cell border and the cell content.

Lets’ see the examples.

Example 1

You can remove cellspacing and cellpading from HTML table without using CSS by adding cellspacing and cellpadding attribute to HTML table.

      <table cellpadding="0" cellspacing="0" border="0">

            <tr>

                <td>

                    Aamir Hasan

                </td>

                <td>

                    www.aspxtutorial.com

                </td>

                <td>

                    .NET Articles

                </td>

            </tr>

        </table>

 

This will look like this:

Aamir Hasan

www.aspxtutorial.com

.NET Articles


Example 2

Example2 shows you how to remove cellspacing and cellpadding from HTML table with CSS.

Following CSS will remove cellspacing and cellpadding from the table.

  <style type="text/css">

        table

        {

            border-collapse: collapse;

        }

        th, td

        {

            padding: 0;

        }

    </style>

 

Example3

Example3 shows you how to remove cellpading and cellspacing from a specfic table.

Let us create a css class as shown below.

 

  <style type="text/css">

      #table1

        {

            border-collapse: collapse;

        }

        #table1 th, #table1 td

        {

            padding: 0;

        }

 

Apply above css class named "table1" as  given below table.

      <table class="table1">

            <tr>

                <td>

                    Aamir Hasan

                </td>

                <td>

                    www.aspxtutorial.com

                </td>

                <td>

                    .NET Articles

                </td>

            </tr>

        </table>

 

I hope you like the article

Tags: , ,
Category: All | CSS | HTML
Protected by Copyscape Online Plagiarism Tool

Comments (4) -

Timika Klave
Timika Klave United States
8/23/2015 12:02:18 AM #

Fantastic blog you have here but I was curious about if you knew of any community forums that cover the same topics discussed here? I'd really love to be a part of group where I can get suggestions from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Many thanks!

Manie Berendt
Manie Berendt United States
8/24/2015 11:50:52 PM #

Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

Humberto Congrove
Humberto Congrove United States
8/25/2015 8:26:40 PM #

Sung Abdon
Sung Abdon United States
9/2/2015 10:32:51 PM #

As soon as I  observed  this  site I went on reddit to share some of the love with them.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5