473,386 Members | 1,748 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.

Preventing Inheritance?

Bob
I need to apply a border to a table's columns, but not to the columns
of tables nested within (I realize nested tables are bad form, it's a
client request). I can't control what goes inside this table so
applying a class to any nested tables that cancels out this border
isn't an option. Is there any way to prevent the inheritance?
Jul 20 '05 #1
15 26404
Bob wrote:
I need to apply a border to a table's columns, but not to the columns
of tables nested within (I realize nested tables are bad form, it's a
client request). I can't control what goes inside this table so
applying a class to any nested tables that cancels out this border
isn't an option. Is there any way to prevent the inheritance?


It sounds like inheritance isn't the problem here, but that elements you
don't want to match your style definition are matching it as well as ones
you want to match.

Take a look at descendent selectors <http://w3.org/TR/CSS2/> and specify a
different value for the nested elements.

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #2
"Bob" <bo******@hotmail.com> wrote in message
news:a4*************************@posting.google.co m...
I need to apply a border to a table's columns, but not to the columns
of tables nested within (I realize nested tables are bad form, it's a
client request). I can't control what goes inside this table so
applying a class to any nested tables that cancels out this border
isn't an option. Is there any way to prevent the inheritance?


Perhaps you should give your table an ID and apply the style to the ID
selector.

HTH
Regards,
Peter Foti
Jul 20 '05 #3
Bob
David Dorward <do*****@yahoo.com> wrote in message news:<c0*******************@news.demon.co.uk>...
Take a look at descendent selectors <http://w3.org/TR/CSS2/> and specify a
different value for the nested elements.


The problem is I would then be forcing that different value on all
nested elements. For example if I attempt to remove the border style
on nested tables (border:none), a table with the attribute "border=1"
would also lose its border.
Jul 20 '05 #4
Bob
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message news:<10*************@corp.supernews.com>...

Perhaps you should give your table an ID and apply the style to the ID
selector.

HTH
Regards,
Peter Foti


True that would work, but I would end up needing a large number of IDs
for all the table cells. I just kinda figured there was a better way.
Jul 20 '05 #5
It seems "Bob" wrote in comp.infosystems.www.authoring.stylesheets:
I need to apply a border to a table's columns, but not to the columns
of tables nested within (I realize nested tables are bad form, it's a
client request). I can't control what goes inside this table so
applying a class to any nested tables that cancels out this border
isn't an option. Is there any way to prevent the inheritance?


Sure -- your stylesheet should contain one set of styles for table
td and a different set for table table td. The latter, being more
specific, will apply only to nested tables. The former will apply to
both outer and inner tables (except where overridden by table table
td).

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #6
On 11 Feb 2004 17:38:41 -0800, Bob <bo******@hotmail.com> wrote:
David Dorward <do*****@yahoo.com> wrote in message
news:<c0*******************@news.demon.co.uk>...
Take a look at descendent selectors <http://w3.org/TR/CSS2/> and
specify a
different value for the nested elements.


The problem is I would then be forcing that different value on all
nested elements. For example if I attempt to remove the border style
on nested tables (border:none), a table with the attribute "border=1"
would also lose its border.

Then use classes or ID's as well.
Jul 20 '05 #7
Bob
Stan Brown <th************@fastmail.fm> wrote in message news:<MP************************@news.odyssey.net> ...
Sure -- your stylesheet should contain one set of styles for table
td and a different set for table table td. The latter, being more
specific, will apply only to nested tables. The former will apply to
both outer and inner tables (except where overridden by table table
td).


But that isn't preventing inheritance, it's just forcing a new style
on the nested tables, and I don't necessarily want all nested tables
to look the same.

It's too bad you can't reverse-cascade, like applying a style to the
parents of a tag rather than its children/descendants.
Jul 20 '05 #8
On 11 Feb 2004 08:36:50 -0800, Bob <bo******@hotmail.com> wrote:
I need to apply a border to a table's columns, but not to the columns
of tables nested within (I realize nested tables are bad form, it's a
client request). I can't control what goes inside this table so
applying a class to any nested tables that cancels out this border
isn't an option. Is there any way to prevent the inheritance?

Bob, it's a little more coding than you want to do, clearly, but this will
do it.

First, write CSS for basic tables in your document. Then set an ID or
class on the parent table, and style that later in the CSS than the
general table style.

You're seemingly looking for a way to stop inheritance which is really an
essential part of CSS. It's not possible to turn it off without declaring
a conflicting style, or making style declarations to classes.

This serves as another good reason not to do table layout - borders are
not inherited by divs.

On the client request - if you were an architect in the snowy north, and
the client asked you to build a huge room with a flat roof and no roof
support, would you do it? Of course not, you know it's an unwise practice.
You at the very least endanger the structural integrity of the building,
if not the inhabitants.

Yet it never ceases to amaze me that web authors will do whatever the
client asks, even when they know it's poor practice, even when they know
it not only damages the structure and functionality of the page itself but
also makes people not want to be there.

I appreciate the need to keep business, but there's got to be a way to
make web authors as responsible and capable to the needs of the users as,
say, electricians, plumbers and architects. Maybe we ought to have a
licensing board for authors and they are compelled to use sound srtuctural
practices...
Jul 20 '05 #9

"Bob" <bo******@hotmail.com> wrote in message
news:a4*************************@posting.google.co m...
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message

news:<10*************@corp.supernews.com>...

Perhaps you should give your table an ID and apply the style to the ID
selector.

HTH
Regards,
Peter Foti


True that would work, but I would end up needing a large number of IDs
for all the table cells.


Why?

#specialTable { ... }
#specialTable td { ... }

<table id="specialTable">
<tr><td>...
Jul 20 '05 #10
It seems "Bob" wrote in comp.infosystems.www.authoring.stylesheets:
Stan Brown <th************@fastmail.fm> wrote in message news:<MP************************@news.odyssey.net> ...
Sure -- your stylesheet should contain one set of styles for table
td and a different set for table table td. The latter, being more
specific, will apply only to nested tables. The former will apply to
both outer and inner tables (except where overridden by table table
td).


But that isn't preventing inheritance, it's just forcing a new style
on the nested tables, and I don't necessarily want all nested tables
to look the same.


So do you want to "prevent inheritance", or do you want to style
your page in a particular way? Perhaps I was wrong, but I thought it
was the latter. I don't know any way to do the former.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #11
Bob
Neal <ne*****@spamrcn.com> wrote in message news:<op**************@news.rcn.com>...
Yet it never ceases to amaze me that web authors will do whatever the
client asks, even when they know it's poor practice, even when they know
it not only damages the structure and functionality of the page itself but
also makes people not want to be there.


CSS positioning is all well and good, but when the vast majority of
people are still using Internet Explorer, it's not always your best
option. Should the client tell me their customers are reporting
visual problems with the site, I can't very well tell them, "Please
advise the 90% of your customer-base still using IE to upgrade to
Mozilla. Problem solved!"
Jul 20 '05 #12
Bob
"Harlan Messinger" <h.*********@comcast.net> wrote in message news:<c0*************@ID-114100.news.uni-berlin.de>...
Why?

#specialTable { ... }
#specialTable td { ... }

<table id="specialTable">
<tr><td>...


Because the "#specialTable td" style would still apply to nested
tables that don't have that the "specialTable" id.
Jul 20 '05 #13
On 12 Feb 2004 18:24:09 -0800, Bob <bo******@hotmail.com> wrote:
Neal <ne*****@spamrcn.com> wrote in message
news:<op**************@news.rcn.com>...
Yet it never ceases to amaze me that web authors will do whatever the
client asks, even when they know it's poor practice, even when they know
it not only damages the structure and functionality of the page itself
but
also makes people not want to be there.


CSS positioning is all well and good, but when the vast majority of
people are still using Internet Explorer, it's not always your best
option. Should the client tell me their customers are reporting
visual problems with the site, I can't very well tell them, "Please
advise the 90% of your customer-base still using IE to upgrade to
Mozilla. Problem solved!"


See, I disagree that IE is so hopeless in CSS. There's a lot possible in
it. But as I said, you have to stay in business, and if the client won't
pay you unless you do something you'd rather not, you either do it or not
get paid.
Jul 20 '05 #14
On Thu, 12 Feb 2004, Neal wrote:
See, I disagree that IE is so hopeless in CSS.
I think that would have to be measured against the requirements of the
specification. (I mean, rather than the fact that - given enough
effort, study of its anomalies and various disregards of mandatory
requirements of the interworking specifications - it's possible to
work-around its misbehaviours and produce presentable web pages - the
latter is surely not in dispute, but it can hardly be said to command
the description of "supporting CSS".)
There's a lot possible in it. But as I said, you have to stay in
business, and if the client won't pay you unless you do something
you'd rather not,
.... then there was something wrong with the contract that you
accepted!
you either do it or not get paid.


On the other hand, you might find another customer who understands the
medium better, be glad that you dropped a troublesome customer who
really wanted a WYSIWYG deezyner rather than a true WWW engineer, and
the new customer not only pays you but also leaves you satisfied with
the job that you did.

But then, I can't speak from personal experience, since I do this
stuff as a sideline of a full-time employment. So YMMV and all that.
Jul 20 '05 #15
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote in
news:Pi*******************************@ppepc56.ph. gla.ac.uk:
On Thu, 12 Feb 2004, Neal wrote:
There's a lot possible in it. But as I said, you have to stay in
business, and if the client won't pay you unless you do something
you'd rather not,


... then there was something wrong with the contract that you
accepted!
you either do it or not get paid.


On the other hand, you might find another customer who understands the
medium better, be glad that you dropped a troublesome customer who
really wanted a WYSIWYG deezyner rather than a true WWW engineer, and
the new customer not only pays you but also leaves you satisfied with
the job that you did.


A very important point here is that if the reason a consulting professional
would "rather not" do something the client asks for is that his
professional judgment tells him it won't work out, taking on the work
anyway and doing it the client's way means that either one of two things
will happen:

1) It doesn't work out, and the client refuses to pay and goes to someone
else. Sure, if you had a contract that specified that you were going
against your best judgment and weren't responsible for the desired outcome,
you could sue. And, 5-10 years down the road, win. And get a judgment
that you could *try* to collect on. At best, you'd wind up with pennies on
the dollar.

2) It doesn't work out, and the client refuses to pay unless you redo the
job the right way. Twice the work for the same pay.

In *both* cases you'd have been better off turning down the job. If you do
it right (simply explaining, diplomatically, that what the client wants you
to do is against your professional judgment and that he would be better off
with someone whose professional judgment is different from yours--do *not*
employ that "brutal honesty" that geeks are famous for and cast aspersions
on his intelligence, parentage, etc--but that he can always come back to
you if he's not satisfied with the results he gets from someone else), then
there's a good chance that he'll get burned by someone else and will then
be willing to pay you to pick up the pieces.
Jul 20 '05 #16

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
6
by: Sandy | last post by:
Hi, How do i prevent a function from being overridden in the derived class. (like final methods in java) Is there a workaround for it. Thanks.
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
10
by: David Hirschfield | last post by:
Here's a strange concept that I don't really know how to implement, but I suspect can be implemented via descriptors or metaclasses somehow: I want a class that, when instantiated, only defines...
4
by: Blue Apricot | last post by:
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...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.