External Style Sheet

<head>
<link rel="stylesheet" type="text/css"
href="mystyle.css" />
</head>

*Do NOT leave spaces between the property value and the units! If you use “margin-left: 20 px” instead of “margin-left: 20px” it will only work properly in IE6 but it will not work in Mozilla/Firefox or Netscape.

Internal Style Sheet

<head>
<style type="text/css">
hr {color: sienna}
p {margin-left: 20px}
body {background-image: url("images/back40.gif")}
</style>
</head>

A browser normally ignores unknown tags. This means that an old browser that does not support styles, will ignore the tag, but the content of the tag will be displayed on the page. It is possible to prevent an old browser from displaying the content by hiding it in the HTML comment element:

<head>
<style type="text/css">
<!--
hr {color: sienna}
p {margin-left: 20px}
body {background-image: url("images/back40.gif")}
-->
</style>
</head>

Inline Styles

<p style="color: sienna; margin-left: 20px">
This is a paragraph
</p>

If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet.

Post a Comment

*
*