problems migrating to better use of CSS

They have: 461 posts

Joined: Jul 2003

i had 10 ways i started a table tag. on example:

<?php
$tsw750
='<table frame=\"void\" bgcolor=\"#878787\"
border=\"0\" cellpadding=\"0\" cellspacing=\"0\" text=\"#ffffff\" width=\"750\">'
;
?>

it now looks like...
<?php
$tsw750
='<table frame=\"void\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
class=\"reg\" width=\"750\">'
;
?>
with this CSS:
/* tables */
table.reg {
  background-color:#878787;
  color:#ffffff;
}

table.req {
  background-color:#FF0000;
  color:#ffffff;
}
'when i added cell padding (padding:0) it didn't work.
i've looked at w3cschools.com's CSS stuff, but am not sure how to get cell spacing and cell padding into CSS if that's possible. I made the site to conform to html 4.0 since i don't have extensive CSS experience. i'm now trying to move anything that can be moved to CSS to gain experience with that, and to make this more forward compatible since i noticed things like and are deprecated in html4.01 and unsupported in xhtml 1.0.. i figure by 2.0 aill go the way of align and and join the rest in deprecation if not outright removal from valid tag/options. i'm currently moving bolding, italics, etc to in the pages.

note: php code edited to prevent scrolling

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

druagord's picture

He has: 335 posts

Joined: May 2003

to my knowledge cellspacing particularly cannot be set trough css, for cellpadding margins do a similar effect

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Um, use and for and unless they are for specific types as they are semantic markup and will not be deprecated.

$tsw750='<table class="reg">';

with this CSS:

table.reg {
  background-color:#878787;
  color:#ffffff;
  border: 0;
  padding: 0;
  width: 750px;
  border-collapse: collapse;
}

.reg td {
  vertical-align: top;
  padding: 0;
  border: 0;
  border-collapse: collapse;
}
'

If you're doing data markup, try looking up CSS for tables, it's quite large and a lot of it is supported.

They have: 461 posts

Joined: Jul 2003

what about ? i figured that and would get deprecated soon since they seem to be the same as / and respectively

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

well instead of guessing, I'd recommend you hop on over to w3.org and find out for real instead. Wink

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://www.webstandards.org/buzz/archive/2003_09.html#a000203 has a number of good links on how to use tables for tabular data to better effect using standards and CSS.

They have: 461 posts

Joined: Jul 2003

iddn't find anything specifically on div and classes.
i know that w3cschools notes that align is deprecated.

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=%22class%22+%22div%22+%22html%22

is the search i didn but can't find anything on why using a div with a CSS class that had "text-align:center;" was completely overlooked.

i haven't tried a diff class that didn't include that because the thing that's most crucial IS the alignment.

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Where didn't you find anything specifically on div and classes?!

Don't mix DIV and TABLE -- that's just asking for trouble.

Edited to add: I mean for positioning. Clearly you'll have to use DIV and TABLE together for data sites and DIVs can be useful in TABLE layouts as well.

He has: 173 posts

Joined: Nov 2002

Quote: By m3rajk: "I don't have extensive CSS experience."

Perhaps THIS REFERENCE SHEET would be of some help. Smiling

I noticed you said {padding:0} didn't work in your CSS. On the above-mentioned reference sheet, the only shortcut I'm seeing is something like

{
padding: 5px 15px 5px 15px;
}.

Perhaps just {padding:0} will not work(?), but there seems to be many shortcuts depending on who is writing these tutorial-type things.

Anyway, the longer CSS version (not the short cut shown above), according to this reference sheet, would be something like the following:

{
padding-top: 5px;
padding-right: 15px;
padding-bottom: 5px;
padding-left: 15px;
}

Hope that (and the reference sheet) will be of some help, and good luck.
I know nothing about the PHP part, though. Laughing out loud

They have: 461 posts

Joined: Jul 2003

thanx feisty. it turned out that it was calling it in table and not td.

thanx a lot for that ref sheet. i'v been using the one at w3c schools, but i like that one better, has things not mentioned in the w3cschools one (i just added yours to my bookmarks)

suzanne-

w3cschools just says it's deprecated, not that it's only deprecated for certain tags. i took that to mean that it's deprecated in ALL tags.

but that still doesn't explain why when i had a class that changed the font-face, font-color and should have set a text align of center, the class only did the first two. the text-align was ignored

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

1. no, an attribute that's deprecated for A tag is not necessarily deprecated for ALL tags. HOWEVER, in this case, yes, for XHTML + it's deprecated for DIV and TABLE tags (and possibly TD, but I don't use it so I've never bothered to figure that out).

2. Depends on the browser, you may have hit a glitch, but not having centered aligned TEXT is not what you were talking about! You were talking about the container being aligned center, and for that, it's margin: 0 auto 0 auto; where 0 is however much you want on the top and then on the bottom.

Provide a working page and you'll get a proper answer, and please, be as clear as possible about your questions. Posting a pile of code isn't helpful, since people then have to make their own pages to test it. Make a test page!

Or check out the VERY GOOD DEVELOPER RESOURCES I posted in earlier responses. If you're getting stuck on something too basic to be listed, the only way we'll find it is with sample broken code.

They have: 461 posts

Joined: Jul 2003

actually the inital question wasn't realated to centering. lol.

and yes, i see where stating i was using it for a div the first time was a little less than well phrased (ok, a lot less)

my browser is mozilla 1.3.1

well that's the one i'm doing the primary testing in. unfortunately ie has reclaimed default on me again Sad i hate M$ and it's insistence that it has to be all the defaults. i figure with the ie end of life announcement, i shouldn't bother using that as the primary browser to test. i'm actually going back after i have it working like i want in mozilla and making sure it's ok in ie

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

They have: 461 posts

Joined: Jul 2003

i've noticed that while the class is ignored in div on mozilla, it's utelyzed by ie

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

url

They have: 461 posts

Joined: Jul 2003

used to have it on the test page mentioned for css. i think it's still set up like that. just edited it to include a table
http://24.91.157.113/findyourdesire/zhtmlsetup.html

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.