473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Nexted Tables, Preventing Cascade

How can I prevent certain Class properties from cascading from a parent
table to its children?

Specifically, I have a table that acts as a container (I call it
class="page"), with a certain border, background color, padding, etc.
I am finding that the tables that it contains "inherit" certain
attributes, like padding, which I do not want them to do.

Can I prevent this "cascade"?

Interestingly, if the same properties are defined as an inline style --
that is, not within a class -- they are not inherited. Can someone
explain why this would be?

Thanks,
Blue Apricot 416

Nov 27 '06 #1
4 6368
Blue Apricot wrote:
How can I prevent certain Class properties from cascading from a parent
table to its children?

Specifically, I have a table that acts as a container (I call it
class="page"), with a certain border, background color, padding, etc.
I am finding that the tables that it contains "inherit" certain
attributes, like padding, which I do not want them to do.

Can I prevent this "cascade"?

Interestingly, if the same properties are defined as an inline style --
that is, not within a class -- they are not inherited. Can someone
explain why this would be?
We can try guessing what your code looks like, but without specifics
it's really hard to tell.
Nov 27 '06 #2

Blue Apricot wrote:
How can I prevent certain Class properties from cascading from a parent
table to its children?
Start by posting a URL so that we can see what you're doing.

You can't prevent the cascade. Your options are to either over-rule it
by soemthing even more specific, or (usually better) to stop it
mis-applying itself in the first place by making the selector that
first applies the rule more specific.

Validating your CSS at the W3C site and then studing the tree it
returns is often instructive.

Nov 27 '06 #3
Andy Dingley wrote:
Blue Apricot wrote:
How can I prevent certain Class properties from cascading from a parent
table to its children?

Start by posting a URL so that we can see what you're doing.

You can't prevent the cascade. Your options are to either over-rule it
by soemthing even more specific, or (usually better) to stop it
mis-applying itself in the first place by making the selector that
first applies the rule more specific.

Validating your CSS at the W3C site and then studing the tree it
returns is often instructive.
Due to popular demand, here is a URL that shows the effect I want to
avoid:

http://s161149005.onlinehome.us/DEMOS/NESTED/

There are 3 tables here. The main table holds another table in its
Cell F which hold another one-cell table in its Cell N4.

I understand that part of CSS is the "cascade", where certain
properties cascade down. But can I avoid this?

Specifically, I do not want the White Table (class="nested") to
"inherit" the padding, borders, etc. of its "parent" (class="page").
Furthermore, the 3rd table, which has no class defined at all, inherits
the dashed border from its holder (which inherited it from its holder)
and the white background from "nested".

Is there a way to avoid this? A way of over-riding the cascade from a
parent? A way to make a nested table just take on whatever properties
it has by default, as if it was not contained in a another table (from
which it is receiving "cascaded" properties)?

Thanks,
Blue Apricot 416

Nov 27 '06 #4
..oO(Blue Apricot)
>http://s161149005.onlinehome.us/DEMOS/NESTED/
[...]

Specifically, I do not want the White Table (class="nested") to
"inherit" the padding, borders, etc. of its "parent" (class="page").
Furthermore, the 3rd table, which has no class defined at all, inherits
the dashed border from its holder (which inherited it from its holder)
and the white background from "nested".
It's no inheritance (borders and paddings are not inherited), but simply
caused by your selectors:

TABLE.page TD {...}
TABLE.nested TD {...}

These apply to _all_ table cells that are somewhere inside tables of the
class "page" or "nested". It doesn't matter if they directly belong to
that table or if they belong to a nested table five levels deeper.
>Is there a way to avoid this? A way of over-riding the cascade from a
parent? A way to make a nested table just take on whatever properties
it has by default, as if it was not contained in a another table (from
which it is receiving "cascaded" properties)?
Without changing the code pretty much the only solution is to explicitly
apply some styles to the nested table to override the "inherited" rules:

table.page td {padding: 5px; ...}
table.nested td {padding: 0; ...}
table.nested table td {...}

Another way to apply styles only to a particular table without affecting
the nested ones are child selectors, but that won't work in IE6.
Something like

table.nested>tbody>tr>td {...}

But why is there a nested single-cell table at all?

Micha
Nov 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bmccollum | last post by:
I have written a trigger that's supposed to go out and delete corresponding records from multiple tables once I delete a specific record from a table called tblAdmissions. This does not work and...
1
by: Dominic Marks | last post by:
Hi, (I apologise if this is the wrong list, I haven't posted to a postgresql.org mailing list before, general seemed like a good catch-all) I am trying to implement a centralised...
2
by: Ben | last post by:
Right now I have 1 table. The first part is the first and last name along with address etc. There is about 10-15 fields here. The second part consists of times, penalties and if they enter this...
1
by: Mark Lees | last post by:
Do I need to create a relationship between fields in a table I created for a lookup(combo box) and the actual table that contains the combo box? Or do these lookup tables exist independently of the...
4
by: Heather | last post by:
I am creating a database with a backend and frontend. The backend consists of a Products table and many other tables. The products table in an .mdb file by itself is over 2 meg. I thought about...
5
by: Giggle Girl | last post by:
Is there a way to prevent properties (specifically, height and background color) from being "inherited" by nested tables? Something similar (but sort of opposite to) !important, like...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: akdemirc | last post by:
Hi, i have tree tables in my db, one for menu, one for menu items and the other authorization.. They have the following columns and relationships: Menu ----------------- id (PK), name, position...
50
by: bonneylake | last post by:
Hey Everyone, I was wondering if anyone could provide a tutorial or example on how to create a stored procedure that uses delete cascade to delete records from 2 tables? i have seen examples...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.