Here is the general format for creating internal cascading styles
- Write the style tags in the head section of the code .
<head>
<style >
hr {color: sienna;}
p {font-family: Arial, Verdana, sans-serif; color: #00008B;}
body {background-color: #5F9EA0;}
</style>
</head>
How to write a style rule: CSS Syntax
- The CSS syntax is made up of three parts: a selector, a property and a value
- selector {property: value}
- body {background-color: #5F9EA0;}
- The selector is normally the HTML element/tag you wish to style. Example: body.
- The property is the attribute you wish to change. Example: Background-color:
- Each property can take a value. Example: #5F9EA0
- Think about people. hair{color: white;}
- The property and value are separated by a colon, and surrounded by curly braces. End each style rule with a semi-colon; to keep rules separate from one another.
I write my style rules like this to help me better organize them. I can easily find a rule to revise it when the rules are written like this:
h4 {
font-size: 18px;
text-align: left;
font-style: normal;
padding: 10px;
font-variant: small-caps;
}
We can group various html elements together to give them the same style
p, li, dl {
font-size: 12px;
text-align: justify;
line-height: 1.2em;
margin: 35px;
}