Jump to content

cellspacing and cellpadding in CSS


Vantskruv

Recommended Posts

In HTML-code I use cellspacing and cellpadding like this:

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

I get the same results in CSS when coding like this:

table {	margin: -1px;	padding: -1px;}

What troubles me is it really legable to add a negative value in the margin and padding variables in the CSS-coding? Does this CSS-code really act exactly the same way as the HTML-code?/VantskruvEdit: Note that when using values 0px instead of -1px in the CSS-code the result will be different than the HTML-code.

  • Like 1
Link to comment
Share on other sites

Firstly welcome to the group! :) Yes margin and padding is what should be used instead. (Even better, unless the table is being used to display tabular dont use the table at all) The reason there are negative margins is cos they have other uses other than tables too, margin and padding are an important part of using CSS for layout.Problem comes that sometimes diffrent browsers interprate these propertys diffrently though and can cause problems, though easy enough to fix. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...