Mynscu Posted November 3, 2006 Share Posted November 3, 2006 border="0" cellpadding="0" cellspacing="0" what's the CSS equivalent for these html atributes?I've been using border-collapse:collapse; border-spacing:0; padding:0 but it doesn't create the same effect? Does adding padding:0 for every td solve the issue? Link to comment Share on other sites More sharing options...
utopia Posted November 3, 2006 Share Posted November 3, 2006 border="0" cellpadding="0" cellspacing="0" what's the CSS equivalent for these html atributes?I've been using border-collapse:collapse; border-spacing:0; padding:0 but it doesn't create the same effect? Does adding padding:0 for every td solve the issue? For the border you can use >> border: 0px;There is no CSS CELLPADDING property or attribute, however, the CSS padding property can do the same thing and more, see w3schools.com/csscellspacing can be used in combination with the above, note the latter two attributes add little meaning to tables.So the code should become something liketable {border: 0px;padding: 0px; /*really optional*/margin: 0px; /*really optional*/}happy learning Link to comment Share on other sites More sharing options...
Mynscu Posted November 6, 2006 Author Share Posted November 6, 2006 Tried it...it doesn't produce the same effect.If I add border-collapse:collapse then it has the same effect as the html attributes. Link to comment Share on other sites More sharing options...
vchris Posted November 6, 2006 Share Posted November 6, 2006 I created a table recently and I used padding to replace cellpadding and it seemed to look exactly the same. Link to comment Share on other sites More sharing options...
aspnetguy Posted November 6, 2006 Share Posted November 6, 2006 I would be surprised if this worked the same as cellpadding="5" table{ padding: 5px;} I would expect this,however, to work the same td, th{ padding: 5px;} cellspacing and margin would work much the same way. Link to comment Share on other sites More sharing options...
vchris Posted November 6, 2006 Share Posted November 6, 2006 aspnetguy, that's what I meant. Sorry I didn't precise. I used padding on the td and th. Link to comment Share on other sites More sharing options...
Mynscu Posted November 6, 2006 Author Share Posted November 6, 2006 body {padding: 0px;margin: 0px;}table {border: 0px;padding: 0px;margin: 0px;border-collapse:collapse; }td, th {padding: 0px;} I am using this stylesheet right now and it seems to have the same effect as border="0" cellpadding="0" cellspacing="0" if I remove border-collapse then borders appear and it's not good.Anyways, another quick question (really don't want to start a new topic for this ). How do I make the width of a table cell remain the same no matter the text it contains. I tried just plain old width but it really didn't seem to have any effect if the text was longer. Also tried max-width with kinda the same effect.The height of the table is not restrained in any way. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now