
In turn, tags have their own children - tags which indicate a single table cell.įigure 1: Here’s the structure of a very basic Web page composed of one headline and two paragraphs: The tag and tag represent two lines of this Web page’s “family tree.” They are both children of the HTML tag, but have distinct family lines. For example, every tag has at least one (table row) inside it. If all this talk of a family tree doesn’t make sense to you, here’s another way to think about it: If a tag is nested inside of another tag, it’s a descendent of that tag. The and tags are its immediate children, and they in turn have their own children - the tag, for example, is a child of the tag. For instance, the tag is like the patriarch (or matriarch) of the family - all other tags are its offspring (see Figure 1). You can also think of a Web page as a family of sorts, containing parent-child relationships. In fact, from generation to generation, children inherit characteristics from their parents, who in turn inherited those traits from their parents. When people have children they can pass on certain physical traits - hair color, height, build, etc. Inheritance, in the world of CSS, isn’t all that different from inheritance in the real world. If not, read on for an explanation of what it is and how you can use CSS inheritance to work more efficiently. If you’re at all acquainted with style sheets in QuarkXPress or Adobe InDesign, these principles will be familiar to you. Called inheritance, this feature is a powerful and sometime confusing concept to grasp. One concept that trips up beginners but saves a lot of formatting time for seasoned pros is the ability of a CSS style to pass on its properties to other tags in a page. CSS is an important feature of Web design programs such as Macromedia Dreamweaver and Adobe GoLive.
#Inherit font css full#
This powerful addition to your Web design toolbox finally lets you explore many of the formatting possibilities that print designers take for granted: leading, first-line indents, precise margin control, and sophisticated border options, to name a few.īut in order to use CSS to its full potential - and take advantage of many of its labor-saving features - you need to learn the ins-and-outs of this exciting new technology. Perhaps you’ve even completely abandoned most old-school HTML formatting such as the font tag in favor of CSS. You have to declare the entire value as “inherit” or else not use it at all.If you’re like many Web designers, you’ve probably dabbled a bit with cascading style sheets (CSS). If you use inherit on any of the shorthand properties (like font or list-style), you can’t use it along with other values. Properties That Inherit by DefaultĪs mentioned, some properties already inherit their values from their parent element without needing to explicitly tell it so. So, if you aren’t concerned about IE6/7 then you’re safe to use the inherit value on whatever property you want.

However, since direction and visibility already inherit by default (see below), this seems somewhat pointless. With two exceptions: Those browsers do support inherit on the direction and visibility properties. The only browsers that don’t support the inherit value are IE6 and IE7 (shocking, I know).

And naturally, if you need to reverse the inheritance, you can either remove the property/value pair, or else set it to “normal” instead. Whatever the case, just know that you have the option to use the inherit value. Or maybe you want access to an easy way to change the value via JavaScript or jQuery. There might also be default styles set by the user agent that you want to override (assuming you’re not already doing so in a CSS reset).


Maybe there are other paragraphs with borders set, and so you don’t want those to be affected. But there could be some instances where the inherit method would work better. After all, you can just do this:Īnd that would accomplish the same thing.
#Inherit font css skin#
Of course, this seems like just another way to skin the cat, as they say.
#Inherit font css code#
So, if for some strange reason, you wanted all of your paragraphs to inherit the hot pink border of their parent element, then the code above would accomplish this. Here’s an example of how you might do this: If you want, however, you can force a property in a child element to inherit the value for that property from its parent by using the inherit value. So, a number of properties in the CSS specification are able to naturally pass on their values to child elements. This prevents your CSS from looking something like this: This is useful because it prevents needing to define that same property for all children.įor example, the font-size property can be set (as it often is) on the element, and virtually every element that is a child of will inherit that font-size setting. In CSS, there are some properties that are naturally inherited from parent to child.
