How to use Styles
When the browser reads a stylesheet, it formats the document according to the style sheet. There are three ways to insert the style sheet:
External style sheet
An external style sheet is an ideal choice when the style needs to be applied to many pages. With an external style sheet, you can change the appearance of the entire site by changing a file.
<link rel="stylesheet" type="text/css" href="mystyle.css">
Internal style sheet
An internal style sheet can be used when a particular style is required for a single file. You can define an internal style sheet in the head section through the <style> tag.
<style type="text/css">body {background-color: red}p {margin-left: 20px}</style>
inline style
Inline styles are used when special styles need to be applied to individual elements. The way to use inline styles is to use style attributes in related tags. Style properties can contain any CSS properties. The following example shows how to change the color and left margin of a paragraph.
style="color: red; margin-left: 20px">this is a paragraph</p>
| label |
Description |
| <style> |
Defines a style definition. |
| <link> |
Defines a resource reference. |
| <div> |
Defines a section or area (block-level) in a document. |
| <span> |
Defines a small block or area within a line in a document. |
| <font> |
Specifies the font, font size, and font color of the text. Do not approve of use. Please use a style. |
| <basefont> |
Defines the base font. Do not approve of use. Please use a style. |
| <center> |
Centers the text horizontally. Do not approve of use. Please use a style. |
HTML (vi)------CSS