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



AddThis Social Bookmark Button

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 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:

Code:
  1. <link href="style/mystyle.css" rel="stylesheet" type="text/css" />

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:
  1. <style type="text/css">
  2. <!--
  3. a {
  4. color: #aabbcc;
  5. text-decoration: none;
  6. }
  7.  
  8. #mainArea {
  9. color: #999999;
  10. }
  11.  
  12. -->
  13. </style>
  14.  

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.   

Code:
  1. <a href="#" style="color:#990000; font-weight:bold;">Demo</a>




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

F1 Site Family
AJAX F1
CSS F1
Database F1
Flash F1
HTML F1
Java F1
JavaScript F1
PhotoShop F1
PHP F1
Windows F1
 
 
MaxTutorial
Monthly mortgage payment calculator
WebFormGenerator
Alpari forex

Total time: 0.3264