When you add an inline style to an HTML tag it not only affects that tag, but also affects all of the tags and elements within that tag (assuming an inner tag doesn't have another value for that CSS style to overrule it). Here is an example of this:

<BODY style=”color: blue;”>
Hello, I am directly inside the body tag.
<p>I am inside of a p tag!</p>
</BODY>

Will return:

Hello, I am directly inside the body tag.

I am inside of a p tag!

NOTE: Keep in mind that a semicolon should ALWAYS come after a CSS style, regardless of where that style is located (i.e. external style sheet, inline style, etc.).

The following are some CSS examples to help you better understand CSS and how to select certain HTML tags:

h1{
/*any CSS rules written inside of these curly brackets would alter all of the h1 tags. */
}
h1, h2{
/*any CSS rules written inside of these curly brackets would alter all of the h1 tags and all of the h2 tags*/
}
h1 h2{
/*any CSS rules written inside of these curly brackets would alter all of the h2 tags that are found within any h1 tag */
}

In the CSS examples given above, the tags "h1" and "h2" can be replaced freely with any HTML tags you are wanting to use! For example:

div p{
/*any CSS rules written inside of these curly brackets would alter all of the p tags that are found within any div tag */
}

For a list of HTML tags, please visit my list of HTML tags.

Previous Next

Startup Discount
Small Business?
Contact us for an Enormous Discount!