Table of Contents
- Hello World!
- Understanding Tags and Structure
- Whitespace in XHTML
- Breakdown of a Tag
- Attributes
- Paragraphs and Line Breaks
- Validation and Browser Tools
Basic Structure
The Style Attribute
The style attribute is one of the most powerful attributes you have access to. The style attribute can be added to almost any tag, and has hundreds of potential values that allow you to quickly and efficiently change the styling of some content. The style attribute's value is a little more complicated than every other attribute's value. Lets look at an example of a style attribute applied to a paragraph tag.
This will result in this:
Styling a Paragraph
This text will be red.
Note that you do not need to include the style
attribute in the closing tag, </p>.
The style attribute's value is split into two parts:
- property: Identifies the specific element of styling you intend to change.
- value: The style you are applying to the element.
<tagname style="property1: value1; property2: value2; ">
...(text or more tags go here)...
</tagname>
You can add as many properties to a style tag as you wish, and separate properties are divided by a semicolon (;). We are going to learn a number of different properties for the style tag, the first of which are the color and the background-color properties.
