Any experts on cascading style sheets?

Argo

Lifer
Apr 8, 2000
10,045
0
0
Let's say I have an element that's rendered via some styles and other html elements, namely tables. When that element appears by itself it looks just fine. However, when it's inserted into another table that has its own classes defined the target element's tables end up inheriting classes from the parent table and that totally messes it up.

Is there some work around to this problem? Like a keyword that says 'do not inherit any classes from the parent element'?
 

Celeryman

Senior member
Oct 9, 1999
310
0
76
Make sure that your class names are correct (in both the HTML and the CSS), and each seperate class contains style definitions for everything that you want styled.

Edit: Posting your code would not be a bad idea. :)
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Unfortunately that's the way the "cascading" part of CSS works and I'm not aware of any keywords that can prevent inheritance from the parent. You can just target the table you inserted like:

table.parent table.child

and redefine it however you want it to be.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
The problem is that the child object is a fairly generic object (dynamically generated image button) and can be potentially placed within any other element. So would defining every possible style on the child element work?
 

hdeck

Lifer
Sep 26, 2002
14,530
1
0
don't use classes, give the image div it's own name in the style sheet. i have no idea what i'm talking about.
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Can you post the code here? It'll be a lot easier :)

I'm going with hdeck with this one - assign a unique class name to the image button and define all attributes so that it'll override all inherited attributes.