Cascading style sheets (CSS) is a language that works with HTML documents to define the way content is presented. The presentation is specified with styles that are placed directly into HTML elements, the head of HTML documents, or separate style sheets.
Styles sheets contain a number of CSS rules. Each rule sheets elements in HTML documents. Theses rules then define how the elements will be styled.
There are three types of style sheets that can influence the presentation of an HTML document in a browser. These are:
Cascading means that styles can fall (or cascade) from one style sheet to another. The cascade is used to determine which rules will be apply to a document.
You’ve already seen how HTML pages are created using tags. I want to stop briefly and discuss attributes as well. An attribute is an additional bit of information that somehow affects the behavior of a tag. Attributes are included inside the opening tag in a pair. Here’s an example:
<tag attribute=”value”>
Some attributes can be used with nearly any tag; others are highly specific. One attribute that can be used with nearly any tag is style. By including the style attribute in a tag, you can include one or more style rules within a tag itself. Here’s an example using the <h1> tag:
<html> <head> <title>My Sample HTML Page</title> </head> <body> <h1 style="font-family: Verdana, sans-serif;">Heading</h1> </body> </html>
The style attribute of the <h1> tag contains a style declaration. All style declarations follow this same basic pattern, with the property on the left and the value associated with that property on the right. The rule ends with a semicolon, and you can include more than one in a style attribute by placing commas between them. If you’re only including one rule in the style attribute, the semicolon is optional, but it’s a good idea to include it. In the preceding example, the property is font-family, and the value is Verdana, sans-serif. This attribute modifies the standard <h1> tag by changing the font to Verdana, and if the user doesn’t have that font installed on his system, whichever sans-serif font the browser selects.
There are many, many properties that can be used in style declarations. Putting a declaration into a style attribute is just one of several ways that you can apply styles to your webpage.
genuinely a fantastic post. I will definitely be reading this blog more.