|
CSS Home
CSS TutorialIntroductionCSS Advantages CSS Syntax Implementing CSS CSS Class CSS ID CSS Font CSS Text CSS Background Code CSS Border CSS Margin CSS Padding CSS Lists CSS Height & Width CSS Positioning CSS Float CSS Layers CSS Summary CSS CodesCSS AlignCSS bgcolor CSS Cellpadding CSS Cellspacing CSS Hyperlinks CSS Leading Inline Style Sheets Embedded Style Sheets External Style Sheets CSS Scrollbars CSS Table Width CSS Print Version CSS Table-layout CSS ExamplesCSS ExamplesCSS Table-layout Example CSS ReferenceCSS Mini TutorialCSS Properties CSS Color Codes CSS Template CSS Media Types Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
CSS CellpaddingYou may be familiar with the HTML 'cellpadding' attribute of the 'table' tag. This attribute creates space inside of a table cell so that you get a nice bit of white space, or "padding", between your element and the sides of the table. Well, there isn't actually a CSS 'cellpadding' property or attribute, but there is the CSS padding property which allows you to achieve the same effect - and more. You can use this property to set the padding on your table cells. You can even set different padding for each side of the cell. Furthermore, you can use this property on any element - you're not limited to table cells. HTML 'cellpadding' ExampleHere's a typical example of cellpadding usage in HTML. Code:
Result:
CSS 'padding' ExampleTo achieve the same effect using CSS, use the following code. Code:
Result:
You can also use CSS border-collapse to collapse the border. Although this can have a similar effect to cellpadding in some cases, it isn't padding and shouldn't really be used as such. Also see CSS padding, CSS Cellspacing, and CSS border-spacing. Enjoy this website?
Oh, and thank you for supporting Quackit! |
FREE Hosting!With every domain name you register with ZappyHost, you get FREE (ad supported) hosting.PLUS you get:
Featured Template:
(Build your websites in minutes!) |