Using a stylesheet file.
Procedure
- Create a file with an extension .css, for example: ../syles/basic.css
- Add the stylesheet code in this file. See CSS Syntax.
- There are two methods to add a css file to your page:
- Using linked stylesheets
Add inside the <head></head> tags, the following:
Example
<link rel="stylesheet" type="text/css" href="../styles/basic.css" />
<link rel="stylesheet" type="text/css" href="../styles/product.css" />
- Using imported stylesheets
Add inside the <head></head> tags, the following:
Example
<style type="text/css" media="all">
@import "../styles/basic.css";
@import "../styles/product.css";
</style>
Note 1: The imported stylesheet method is supported by browsers of versions 5 and above.
Note 2: The imported stylesheet method is not recommended.
|