Hi, I’ve been designing in HTML, DHTML & JavaScript for a couple of years now, but except for the occasional inline style; I’ve completely ignored CSS until recently. The page I’m working on is a MySpace page (which I’m also just now getting around to fooling with), so there’s a restriction on what scripts I can use. I’m using an embedded CSS, which I’ve customized and like very much. The issue I’m having is this: I created the set of tables below and would like to include it on the page, but I don’t want the embedded CSS to be applied to this particular table (just the rest of the page). I was hoping there’s a tag I can use to enclose the table in to prevent the CSS from being applied, I’ve looked but can’t find it. Then I thought maybe I could use the inline method to “re-define” the table’s style to a default style (as it would appear with no style). But I can’t find anything like this either. Am I barking up the wrong tree or what?
Not quite following your problem, are you trying to stop the table inheriting style from its parent? Is it the content of the table or the table that you are trying to style; or not style as the case may be?
If it is the content then could you not just place the content in a div and style that div. Or if it is the table could you not give the table an id <table id="mytable"> and then define the #mytable styles. Sorry if I am misunderstanding or pointing out the obvious here!
Sorry for not being clear. Yes, I want to stop the table from inheriting style from its parent.
It's both the table and the content inside that I want to have no style applied to. The table is designed to look like a manila file folder with a stack of papers inside, the "top sheet of paper" has a white background so the text inside can be any color but white. The table looks exactly how I want it to (on a page by itself) until I paste it on the page I'm trying to display it on (the destination page) which has an Embedded CSS that tells the (destination) page to apply a black background to all tables and to transform the text from (the default) black to white. So the result is my table no longer looks like the "file folder with papers" inside. The only thing that remains is the border colors of the "file folder". I tried enclosing the table in a div with a white background but it doesn’t really help. I know how to name the table and reference the table name in the Embedded CSS, but what style do I give it if I want it to have “no style”? I guess what I’m looking for is a quick fix for this issue. If that doesn’t exist I guess I’ll have to redesign my “file folder with papers inside” using divs and spans instead of tables.
You're barking up a couple of wrong trees, the first being the "using tables for layout" tree. You're styles aren't "embedded" they are "inline". Factor them out to an embedded style sheet apply them to a table with a given class then give the embedded table(s) another class. Hopefully you can use CSS specificity to separate the styling.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
As I feared, so much for the quick-fix bail-out method. I'm going to go back to the drawing board with this one and I'll do it the right way this time. Thank you both for your help.
What you are trying to do with TABLE and all those TD cells (see attached image) could be very easily rendered using CSS. I'm not sure what you intend to populate this with, -if it is lists of similar textual items grouped under a single defining heading (e.g., "Vegetables" being the <TH> and lists of types of vegetables under it being the relevant <TD>s), TABLE might be the layout you want. But still, with about 1/3 or 1/4 of the current code, CSS can accomplish the same thing.
Yeah, I’m going to redo it using CSS. Actually I think I know a quick fix that would work if I was displaying this table on another site… I could just put the table on an external document and link it into the parent page… but MySpace doesn’t allow that, so I’m going to have to redesign it in CSS. Thank you all for you comments.
Bookmarks