topleft
topright
Combining two classes (3)

 

With CSS you can tell one element that it is to inherit the attributes of a different element. Consider the following classes:
.ClassA{

font-family:Arial;
font-weight:bold;
font-size:0.75em;

}
.ClassB{

border:1 solid black;

}
If I wish to share the attributes of ClassA with ClassB I can declare this in the following manner:
class=”ClassA ClassB”

One can also declare that an attribute of one entity is inherited from the same attribute of a nesting entity:
p{

font-family:inherits;

}
Also consider the following:
p,li{

font-family:arial;
font-size:0.75em;
line-height:1.25em;  

}
li{

margin-left:20px;

}
In this case we wish <li> and <p> to use the same style apart from indentation, we wish the <li> tag to produce an indentation of 20px.
This shows how by redefining part of a style, I can minimise the length of my style sheet.
If I had defined the body tag as:
body{
font-family:arial;
}
Every element would be in font – arial because every other element inherits the font attributes of <body>. See Lie and Boss above.

 

 
London website design | My Ariadne Designs | Downloads | Terms and conditions | Links | Site map Telephone 07989 402130
Ariadne Designs Ltd ©2011