Jump to content

CSS equivalent


Mynscu

Recommended Posts

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

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

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

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

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...