Click to See Complete Forum and Search --> : Inheriting?


Sul
12-12-2003, 05:02 PM
Hi

I'm defining my font properties for normal text on a style sheet, and now I want to define my font properties for a title/heading text. Is there a way that I can inherit the properties of the normal text, and then add on extra properties (some of which that over-ride the normal text properties)?

Thanks.

pyro
12-12-2003, 05:11 PM
If you define the text propreties for the html or body elements (or any other element that the child elements are contained in) the inheritance will be automatic.

Sul
12-12-2003, 05:24 PM
I don't really want to define html elements, so I've created two classes, and I want one to inherit from the other. How do I do this?

toicontien
12-13-2003, 08:36 AM
It could be something like this:

<style type="text/css">
<!--
.class1, .class2 {
color: red;
}

.class2 {
font-weight: normal;
}
-->
</style>
</head>
<body>
<h1 class="class1">This text is red and boldface.</h1>
<h1 class="class2">This text is red, but not boldface. It has properties of both class1 and class2.</h1>
</body>

Is that what you're aiming for?

Sul
12-13-2003, 10:21 AM
Yes, something like that, I'm going to try it out and see.