Forum Moderators: not2easy
If I were to do something like
mainbody.page1{
height:XXpx;
}
Would that code inherit the mainbody class?
Then to reference in the html code, just use
class="page1"
many thanks for the great help here.
if you have got a class mainbody with mainbodyattributes and another class page1 with page1attributes and want some elements to have as well mainbodyattributes as page1attributes you might use both classes like in:
<div name="complex" class="mainbody page1">
and use the selectors .mainbody and .page1
So if you declare
.mainbody {color: red;}
.page1 {height: 12px;}
the div named "complex" will be red and have a height of 12px;
Your suggested selector
mainbody.page1
will not work in the intended way, because it will select an element called mainbody and not an element with class mainbody. To select all elements which belong as well to class mainbody as to class page1 you might write:
.mainbody.page1
Hope it helps (and also that I remembered correctly).
To call the class "page1" from
.mainbody.page1
.mainbody.page1 is a selector and selects any element which belongs to both classes.
.mainbody is also a selector and selects any element which belongs to class mainbody.
If you still are puzzled, perhaps it helps to post some code (html as well as css - but only enough of either to clear your problems).