get CSS tips from world of Internet

Cascading Style Sheets (CSS) is a stylesheet language written in used to describe the presentation of a document written in a markup language. Its most common application is to style web pagesHTML and XHTML,
Save a lot of work with CSS!


CSS Tip: CSS Equivalent to CELLSPACING=0

When using the TABLE tag, there are two attributes that are commonly added; cellspacing and cellpadding. For padding, there is an obvious match with the CSS definition padding. Indeed the attribute for padding-top, padding-bottom, padding-left and padding-right all behave as expected. However there is no directly corresponding property for cellspacing. One might assume that the margin property would provide the same functionality and layout control, but it does not apply to table cells.

It may be tempting to simply include the cellpadding attribute within the table, though there is a CSS equivalent that can be used :-

border-spacing: 3px;

This allows the spacing between cells to be controlled the same as would be possible with cellspacing but with a CSS only solution.

One of the commonest reasons for using cellspacingcellspacing=0. Historically this has been when tables are used for layout purposes. Whilst this is no longer advisable for layout, there are times when tabular data can benefit for zero spacing. With CSS this can be accomplished as follows : is to remove any spacing at all from table cells, with

border-spacing: 3px;
border-collapse: collapse;

The full affect of table cellspacing with a CSS only solution.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s