File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes CSS: referencing other definitions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "CSS: referencing other definitions" Watch "CSS: referencing other definitions" New topic
Author

CSS: referencing other definitions

Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 243

I've been looking high and low, and have been unable to find an answer to this. I've heard that in a css you can define a style by referring to another, for instance, you define something like this:

and if you want to then define another element, to be basically the same (for instance, you want it bold) you can refer to this, so if in the future you want to change it slightly (like the color) it is no problem.
Is it also possible to do it with redefining tags--so if you want text in a <td> and a <p> to be the same, it is no problem.
Thanks in advance.


Mike Firkser
Rutgers '84
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
I am guessing you mean something like this:
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 243

Not really. Maybe this will be a better example:
As most of the standard text in a page is in a table and/or a paragraph, I may want them to be the same. What I want to do is redefine the <p> and <td> tags. Is there a way to redefine the <p> tag (setting font style, etc), and in the redefinition of the <td> tag can I refer to the <p> tag so the font will be the same (in case I forget to put text in a table inside a <p> tag). This way, if I want to change the font from TimesNewRoman to Verdana, I just have to change the <p> tag.
Thanks.
 
 
subject: CSS: referencing other definitions
 
Threads others viewed
using CSS float attribute makes things 'leak' out of their containers ?
while-loop
My first XML code
In CSS - can one class refer to another
change CSS rules dynamic with JavaScript
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com