It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming CSS Forum

Style Tables with CSS

Style Tables with CSS

Postby ebba on Sun Jul 24, 2005 9:36 am

I have a whole table-layout with many different commands and the code gets really dirty. I've just startd out with css and found it very useful. So I thought maybe CSS could help me with styling tables aswell.
ebba
 
Posts: 25
Joined: Mon Aug 16, 2004 7:37 pm

Postby webmaster on Sun Jul 24, 2005 9:48 am

Yes you can, you have the ordinary tags like cellpadding, cellspacing, border, height an all thoose, but there are some more, I think this is all of them:

For <table>
align, bgcolor, cellpadding, cellspacing, frame, border, rules. summary, width

For <tr>
align, bgcolor, char, charoff, valign

For <td>
abbr, align, axis, bgcolor, char, charoff, colspan, headers, height, nowrap, rowspan, scope, valign, width

You can also add styles for the text in the td's or in the table. Here's an example.

To style a table you can use this in your CSS-file:
Code: Select all
.class1 {
   width: 400px;
   border: 0;
}

.class2 {
   width: 40%;
   font-size: 20px;
}

.class3 {
   width: 60%;
}


And then just add a class to the table, tr or td:
Code: Select all
<table class="class1">
   <tr>
      <td class="class2">
         Text Here!
      </td>
      <td class="class3">
         Text Here!
      </td>
   </tr>
</table>
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby ebba on Sun Jul 24, 2005 10:45 am

It works perfectly, thanks a lot for your help.
ebba
 
Posts: 25
Joined: Mon Aug 16, 2004 7:37 pm

Postby ReFredzRate on Sun Jul 24, 2005 2:20 pm

Bummer... I should get back around more often, because that was exactly what I would have posted =/
ReFredzRate
1000+ Club
 

Postby stevex on Wed Aug 03, 2005 8:54 pm

Thought CSS could dispensed with tables(so i hoped)Tables ruined my life.: )
Can anyone tell me how to do this in css,im sure it will help many understand the power.(More questions later,sorry im a novice):www.sg-j.com?table.htm
Thankyou,Steve
stevex
 
Posts: 8
Joined: Wed Aug 03, 2005 8:36 pm

Postby webmaster on Wed Aug 03, 2005 10:39 pm

Stevex: What do you mean, I can't really understand your question. Do you want to see an example how to add the css in a html file?
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby stevex on Thu Aug 04, 2005 5:30 am

Please look at this file www.sg-j.com/table.htn.
I want to do away with the table and have the text and backgrounds specified(especially position and colour)
by css.
Any one know the html for a space?
Thanks,Steve
stevex
 
Posts: 8
Joined: Wed Aug 03, 2005 8:36 pm

Postby ReFredzRate on Thu Aug 04, 2005 6:20 am

Stevex: File not found!
ReFredzRate
1000+ Club
 

Postby webmaster on Thu Aug 04, 2005 8:27 am

Nope, the link isn't working:

HTML FOR SPACE:
Code: Select all
&nbsp;
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby stevex on Thu Aug 04, 2005 8:55 am

Thanks for the html.
Please try this again.www.sg-j.com/table.htm.Its there.
Best,Steve
stevex
 
Posts: 8
Joined: Wed Aug 03, 2005 8:36 pm

Next

Who is online

Users browsing this forum: No registered users and 1 guest