Google Answers Logo
View Question
 
Q: css rule for causing an id to belong to a class ( No Answer,   1 Comment )
Question  
Subject: css rule for causing an id to belong to a class
Category: Computers > Programming
Asked by: alexis_gallagher-ga
List Price: $10.00
Posted: 04 Nov 2004 06:31 PST
Expires: 04 Dec 2004 06:31 PST
Question ID: 424321
I am trying to find out if there is a way to write a css rule that
will cause a tag with a certain id attribute to automatically belong
to a certain class and inherit all the properties already defined for
that class.

In other words, I would like to produce the effect of the following code

#myid, .myclass { blah-blah-blah }

but by writing something in the following form:

.myclass { blah-blah-blah }
#myid { what goes here? }

FYI, I am doing this because the rule ".myclass { blah-blah-blah }" is
defined in a stylesheet outside of my administrative control and
defines rules that are complex and subject to change. Thus, it is not
acceptable for me to have to modify, reproduce, or even view the
content of "blah-blah-blah".

A helpful answer will tell me the syntax I need, or else tell me why
it is impossible in terms of css language definition.

Alexis

Request for Question Clarification by endo-ga on 04 Nov 2004 06:50 PST
Hi,

Can you not add the class attribute to the elements with the given IDs?

Thanks.
endo

Clarification of Question by alexis_gallagher-ga on 04 Nov 2004 08:59 PST
No, I cannot add the class attribute to the elements because the
elements are generated dynamically on the server side by a system out
of my control.
Answer  
There is no answer at this time.

Comments  
Subject: Re: css rule for causing an id to belong to a class
From: lombardp-ga on 08 Nov 2004 03:17 PST
 
As you can read here: http://archivist.incutio.com/viewlist/css-discuss/2685

In CSS it is not possible to define one element in terms of another.


However, if you can accept a JavaScript solution: it is possible to
read the style of YOURCLASS and create a new style rule to be applied
to YOURID. The result is exactly what you need... but achieved with
JavaScript.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy