CSS syntax - Integration of CSS styles
Home - Tutorials - CSS tutorials
In this tutorial I will show you how to use CSS in your projects to make it more flexible.
Tutorial info:
| Name: | CSS syntax |
| Total steps: | 3 |
| Category: | CSS tutorials |
| Date: | 2008-03-31 |
| Level: | Beginner |
| Product: | See complete product |
| Viewed: | 4178 |
Bookmark CSS syntax
Step 3 - Integration of CSS styles
CSS syntax
Now you can create a CSS class, so it's time to look how to integrate it into your HTML document. You have more possibilities:
- Load an external CSS class definition file.
- Define CSS classes inside your header section
- Set CSS in your element parameter list
Load external CSS file
The best way to integrate CSS inside your code is to create a separate CSS class definition file and then import it into your document. In this case you can change the look of your site without touching the HTML code. You can import the CSS file in your header section like this:
Of course you can import more CSS files in a single document if you want.
Define CSS in your header
If you don't want to import CSS from external file, you also can define it directly in your HTML code. In this case you need to create a style section in your header with type text/css. Inside this section you can define your CSS classes as usual.
Code:
<style type="text/css"> <!-- a { color: #aabbcc; text-decoration: none; } #mainArea { color: #999999; } --> </style>
Set CSS as parameter
It can happen that you want to redefine the CSS settings directly inside an element parameter list. You can also do this, however be careful, as this solution can result a very hard to maintain code.
Previous Step of CSS syntax
Tags: css syntax, css basics, css syntax basics
| CSS syntax - Table of contents |
|---|
| Step 1 - The CSS syntax |
| Step 2 - Class, Id definition and tag redefine |
| Step 3 - Integration of CSS styles |