Set cellpadding and cellspacing in CSS

Set cellpadding and cellspacing in CSSIf you are looking for to Set cellpadding and cellspacing in CSS. Then you are at the right place. Here I’m going to tell all the best ways to do this. There are many ways to control and Set cellpadding and cellspacing in CSS, but you can do this with three professional ways.

  • Inline CSS
  • Internal CSS
  • External CSS

You have to select any of the above methods to accomplish your task. If you want to just handle the cellpadding in CSS then you can simply do it with the help of padding. Because padding is the spacing technique which deals with the “space between text and boundary”.

In the above CSS code, we have declared that the table data have padding or spacing from all direction are of 10 pixels. Instead of cellpadding you can use padding attribute too, to do the same task.

Don’t Miss: How To Proportionally CSS Scale Images

Instead of using cellspacing you can be used the alternative border-spacing. It handles the “space between one element to another element” that’s why it’s named as the border-spacing.

The above line of CSS codes will increase the space between each cell with the ratio of 10 px. This CSS property will allow you to do the vertically and horizontally spacing too, but you can’t-do that with you old attributes like cellspacing. It’s recommended to use the latest tags and attributes to make the website responsive and load faster.

Don’t Miss: Create parallax scrolling Effect in HTML

Internet Explorer Issues

Set cellpadding and cellspacing in CSSIf your target users are using the internet explorer which is less than 7 than many problems are issues can arise. The above codes are working in every browser because they get up to date with the update of web languages. But Internet Explorer doesn’t get updates, that’s why they still support the border-collapse property. Which is used to merge the borders of an adjoining table cell. If you want to remove the cellspacing=”0″ then border-collapse:collapse works the same and no spacing between tables cell.

In just short you have to use the above CSS code, border-spacing will handle the non-internet explorer browser for you.

SHARE