- External style sheet
- Internal style sheet
- Inline style
External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension.
Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section. The syntax for linking an external style sheet goes:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
Internal Style Sheet
An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this:
<head>
<style type="text/css">
h1 {color:navy;}
p {margin-left:20px;text-align:justify;}
</style>
</head>
<style type="text/css">
h1 {color:navy;}
p {margin-left:20px;text-align:justify;}
</style>
</head>
Inline Styles
To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property.
example:
<p style="color:navy;margin-left:20px">
This is a sample paragraph.
</p>
This is a sample paragraph.
</p>
0 comments :
Post a Comment