Tech Journal Back to Tech Journal

An elegant way to fix property inheritance in CSS

Nice CSS to fix some things in property inheritance, either by fixing all the elements (*), or by using a class named likeParent:

* {
 font-family: inherit;
 font-size: inherit;
}

.likeParent {
 font: inherit;
 color: inherit;
 text-decoration: inherit;
}

a.likeParent,
a.likeParent:link,
a.likeParent:active,
a.likeParent:visited,
a.likeParent:hover
{
 font: inherit;
 color: #000000;
 text-decoration: none;
}
Last updated on 2008-01-01 05:46:42 -0700, by Shalom Craimer

Back to Tech Journal