problems migrating to better use of CSS

JavaScript and client side scripting.

Moderator: General Moderators

m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

problems migrating to better use of CSS

Post by m3rajk »

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

Code: Select all

$tsw750='<table frame="void" bgcolor="#878787" border="0" cellpadding="0" cellspacing="0" text="#ffffff" width="750">';
it now looks like...

Code: Select all

$tsw750='<table frame="void" border="0" cellpadding="0" cellspacing="0" class="reg" width="750">';
with this CSS:

Code: Select all

/* tables */
table.reg &#123;
  background-color:#878787;
  color:#ffffff;
&#125;

table.req &#123;
  background-color:#FF0000;
  color:#ffffff;
&#125;
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 <s></s> and <u></u> are deprecated in html4.01 and unsupported in xhtml 1.0.. i figure by 2.0 <i></i><b></b><sup></sup><sub></sub> aill go the way of align and <center></center> and join the rest in deprecation if not outright removal from valid tag/options. i'm currently moving bolding, italics, etc to <span class="whatever"></span> in the pages.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

btw, nice number of posts, 777 :D

On the other hand, I'm not sure of what you mean. I've used CSS for well over a year now and I think I'm quite experianced.

Anyhow, you're trying to have cell-padding in cells? With CSS, you have to individually add padding:1px or so. td { padding:0px }, is that what you mean? From what I know, you can't set cellspacing with CSS.

But then I could be wrong,

-Nay
User avatar
Vincent Puglia
Forum Commoner
Posts: 67
Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood

Post by Vincent Puglia »

Hi,

From what I've gathered, you need to pad the cells rather than the table as a whole.

td.req {
padding: 14px;
}

http://www.allmyfaqs.com/faq.pl?Border_for_table_cells

Vinny
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

And you could probably change cellspacing by using td.reg { margin: 0; }.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

darn. that's one thing i like about html then., the fact you can set it in the table.

if that's not deprecated then i think i'll keep it as is for now...
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

It's no harder to do it with CSS.

Here's an example of setting the padding for one specific table, named 'table4'.

Code: Select all

<table id="table4">
 <tr> ....
 </tr>
</table>


<style>

#table4 &#123;
  whatever styles
&#125;

#table4 td &#123;
  padding: 0px;
&#125;

How hard is that? All cells of table4 will now have 0px padding. It accomplishes the exact same thing with about the same amount of effort and greatly improved scalability.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

true. and the option wont be deprecated...

i know that

Code: Select all

<b></b>
<i></i>
<s></s>
<strike></strike>
<u></u>
are all deprecated in html 4.01 and some are unsupported in xhml 1.0, but since these are basically the same as one or more of those, does anyone have an idea if they are going to be deprecated soon?

Code: Select all

<strong></strong>
<em></em>
<del></del>
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

u can also set a different padding to any side:
padding-top: ?px
padding-bottom: ?px
padding-left: ?px
padding-right: ?px
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

I believe that ALL code-side markup will be deprecated in future revisions of XHTML.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

Unipus: i asked the same elsewhere and was givent he response that <em> and <strong> are sgml and not html and wont be. but that brings into question, "will xhtml capable browsers allow sgml to be used in xhtml in te future?"

personally it seems logical to me to deprecate those tags i asked about.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Well, I'm not the expert on these things, you might go look in the W3C recs and see what they're saying. My guess is that either way there should continue to be a Transitional doctype that will accept them if you feel the need to use them.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

IIRC, all of (X)HTML is SGML, it's just a sub-set of a larger markup language.
http://www.washington.edu/computing/tra ... /tree.html

Tags deprecated in XHTML:
http://webdesign.about.com/library/tags ... edtags.htm

Tags such as <strong> and <em> are more useful than <b> and <i> because they provide information to alternative browsers about the importance of the text instead of just being visual markup tags. I would imagine that they, being structural markup rather that formatting markup, will be around for a bit yet.

Mac
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i've been using the charts from http://www.w3cschools.com/

less pop ups than about.com


i wanted to get the site up, don't have a great deal of css experience, so decided i'd do it for html 4.0 then once i have the demop site up, while embellisihing it, move to xhtml and take the time to get to know css better since it would be needed. right now i'm going for html 4.01 since i haven't looked much at the id tag yet and still use name quite a bit
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

GAH!!!

one problem with that.... tables done seemt o be affected by the rules of the div they are in!
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

I'm in the same boat you are... about to launch this site, but over the coming months I'll probably migrate it to XHTML transitional (I doubt it could ever make Strict).

I'm not sure what you mean about ID and NAME, though. ID is just a text identifier for any distinct object on your page. Don't start them with numbers and don't put in spaces... other than that, it's pretty obvious. The only time I find NAME useful is, obviously, for forms. Are you using it for something else?
Post Reply