TD styles and every other style class

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
QuadraQ
Sr. Propeller Head
Posts: 119
Joined: Fri Feb 20, 2009 5:59 pm

TD styles and every other style class

Post by QuadraQ »

OK I'm in a table and would simply like to apply a span class to some text. However the only classes that appear to be available are td and descendents. Is there some way to use my "normal" style classes, or do I have to create a table class?
jwatson
Propeller Head
Posts: 59
Joined: Tue Aug 26, 2008 9:15 am
Location: Victoria, BC

Re: TD styles and every other style class

Post by jwatson »

For paragraph formatting, the easiest thing to do is press Enter to add a paragraph or two, enter your text, apply your paragraph formatting (ie. your regular p. styles) and then delete any extra paragraphs. In tables, when you create a new row, your cells do not automatically have a paragraph added - they're simply table cells with <td> tags, so you only see table styles. An easy way to check that you have a paragraph, is to look at the structure bars (if you have them turned on).

For character formatting, you might need an extra space after the word you want to apply the character format to. Try adding a space, then selecting the word you want to format, and you should see your span character styles.

Jenny.
Jenny
QuadraQ
Sr. Propeller Head
Posts: 119
Joined: Fri Feb 20, 2009 5:59 pm

Re: TD styles and every other style class

Post by QuadraQ »

Thanks I'll try that. After you explained it I think I understand what's going on. :)
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: TD styles and every other style class

Post by stephgl »

This really clears some things up for me as well - thank you!

Now, a best-practices question: for table cells with short entries, is it best to format the majority of the text content with a td class, and then apply spans where exceptions are needed?
-stephgl
jwatson
Propeller Head
Posts: 59
Joined: Tue Aug 26, 2008 9:15 am
Location: Victoria, BC

Re: TD styles and every other style class

Post by jwatson »

If you're going to use the td. styles, make sure that you have identical styles set up for p. as well. For example, you might usually use td.TableText. Be sure to make an identical style called p.TableText. This means that you can use the td styles without having to check that you have a paragraph tag in there, but if you do have to add a second paragraph, your styles match.

However, I think best practice is to just use the p. styles. That limits the number of styles you have to keep track of, and avoids redundant styles.

And then, of course use your span tags or other tags, such as bold, for emphasis.
Jenny
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: TD styles and every other style class

Post by stephgl »

Oh, I see. Thanks Jenny. I think I've already caused myself some problems, but now I think I can straighten them out.
-stephgl
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: TD styles and every other style class

Post by stephgl »

Hm, can I have a single generic class that I can apply to either the p tag or the td tag as needed?
-stephgl
jwatson
Propeller Head
Posts: 59
Joined: Tue Aug 26, 2008 9:15 am
Location: Victoria, BC

Re: TD styles and every other style class

Post by jwatson »

As far as I know (and I'm no expert at CSS) the class has to be attached to one of the standard HTML tags. Have you opened your stylesheet in the Advanced view? You'll see if you select p or td, the names of the classes attached to each of those tags.

So I would say No, you can't create a generic class. But you can create the identical class for td tags as you do for p tags.
You do not have the required permissions to view the files attached to this post.
Jenny
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: TD styles and every other style class

Post by stephgl »

That is a great illustration!

Actually, I have already made generic classes, and once they are there the Styles list will have a [+] (Generic Classes) section where you can click on the plus and see them all.

To make a generic class, first I make it as a class of some other tag, then I open the stylesheet in the internal text editor and remove the tag name from the tag.class style that I just made.

I'm just not sure if a generic class with font properties will work the same with a <p> tag and a <td> tag. I know not all tags treat all properties the same, but I just don't know what those specifics are yet! I'm rather new to CSS but trying to learn as fast as I can!
-stephgl
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: TD styles and every other style class

Post by LTinker68 »

stephgl wrote:I'm just not sure if a generic class with font properties will work the same with a <p> tag and a <td> tag. I know not all tags treat all properties the same, but I just don't know what those specifics are yet! I'm rather new to CSS but trying to learn as fast as I can!
A generic class can be applied to anything, but if the generic class includes an attribute that isn't applicable to the tag you apply it to, then the attribute will be ignored, or it could throw an error. But a generic class should really only contain the attributes that will apply to the types of tags you think you'll be using it with. For instance, don't put a vertical-align:top property in a generic class since that attribute is more commonly used with table cells -- just make it a td class then.

So if you're making a generic class that could be applied to a p or a td, then it could contain font attributes (font family, color, etc.), margin/padding attributes, border attributes, etc. The same generic class could also be applied to a div or blockquote tag, too.

The only gotcha you might come up against is if you use proportional fonts. Depending on how you have the font sizes declared, a p outside of a table may be one size, but a p inside a table cell could have a smaller font size because it's now the child of a td and a grandchild of the body tag instead of a child of the body tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: TD styles and every other style class

Post by stephgl »

Thanks Lisa, that's exactly what I needed.

I did already run into the font sizing issue - I had the same generic class added both the td tag and the p tag, making the final text 80% of 80%! I have some cleaning up to do, but at least now know where the problem lies!!

-Steph
-stephgl
Post Reply