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:
Will return:
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:
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:
For a list of HTML tags, please visit my list of HTML tags.
Previous Next