Topic: padding procedure Pages that link to <a href="https://ozoneasylum.com/backlink?for=11064" title="Pages that link to Topic: padding procedure" rel="nofollow" >Topic: padding procedure\

 
Author Thread
Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-01-2003 08:28 Edit Quote

Hi guys, I've a question about using CSS to apply padding within table cells.

I have a table with, lets say, 10 rows.
Each row alternates in colour, Light grey, Dark grey, Light grey, Dark grey etc.
I've created styles that I have applied to each row that sets the colour of font, the background and also includes padding.

Problem! adding padding to a <tr> style doesn't seem to work!?

I created the same style but applied it to a <td>, padding works fine here, text has a 2px area around it.

What's the reason for this? I though the best way to apply styles here would be to the rows individually instead of every cell!!

Do I need to use a different term for padding when refering to <tr>'s? I've been using padding: 2px 2px 2px 2px; everyhwere else.

Any help would be appreciated.

Cheers,

Blaise

krets
Paranoid (IV) Mad Scientist

From: KC, KS
Insane since: Nov 2002

IP logged posted posted 10-01-2003 15:08 Edit Quote

Why would you want to add padding to a tr? I would think you'd want to do all your formatting inside the td's because that is what is going to contain all your info.

Edit: Oops, nevermind. Why not just make two CSS classes? One for your grey cells one for your black cells. Then you could just do a td class="grey" and be done with it.

:::11oh1:::

[This message has been edited by krets (edited 10-01-2003).]

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

IP logged posted posted 10-02-2003 00:05 Edit Quote

could you show an example? doctype and all that rot?

mebbe try

code:
table {
table-layout : fixed;
}



and see if that helps you any

TRs are kinda sketchy hole in my knowledge (among many other things =)

edit: bluh, nevermind, no, I don't think you can add padding to a tr, but you can just specify 2px instead of 2px 2px 2px 2px in other areas or for top/bottom left/right use 2px 0px for 2px on t/b and 0px on l/r

TRs are just not there, pretend they're not there If you're doing 2 alternatin row colors I spose you'll have to set the default in td then the second in td.class

Jason

[This message has been edited by JKMabry (edited 10-02-2003).]

Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-02-2003 01:24 Edit Quote

Well the reason why I wanted to do it in TR's is because I read somewhere taht you should use the least amount of code possible, if I've got 5 columns and 20 rows I don't want to have to right out the class each time for every cell, when I can do it for each tr.

Oh Well, I've decided to use td's anyway.

Cheers,

Blaise

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 10-02-2003 01:42 Edit Quote

With CSS, you can apply styles to hundreds of elements on the page with just one line. For instance, if your table has id="paddingtable", you can use this line of CSS to apply padding to every single cell within it:

table#paddingtable td {
padding:10px;
}

Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-02-2003 07:47 Edit Quote

That's the ticket!!!

Cheers dude!

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

IP logged posted posted 10-02-2003 17:25 Edit Quote

I thought each row needed different specs? that will apply to every td in the table. I need to read instead of skim maybe, or read mind =)

While we got Slime in the house, or anyone else for that matter, do you know anything about why TR's aren't more tweakable? Lots of stuff doesn't apply to them and I don't think you're supposed to put any attributes in them at all... Just seems like uses for those sort of things, good uses, but you can't do it.

Jason

krets
Paranoid (IV) Mad Scientist

From: KC, KS
Insane since: Nov 2002

IP logged posted posted 10-02-2003 17:43 Edit Quote

Maybe he could use

tr#blackrow td {
}

tr#greyrow td {
{

Eh?

:::11oh1:::

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

IP logged posted posted 10-02-2003 18:38 Edit Quote

id's can be used but once per page, they specifically identify a single page element. Works with classes tho. Bitchin.

Jason

[This message has been edited by JKMabry (edited 10-02-2003).]



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu