News Tutorials Projects Reviews Authors Contact Search Links Admin
 

CSS Introduction : CSS in HTML

Ways of linking CSS with HTML

There are three ways to use CSS with your HTML documents, as shown below.

Way 1: Link to external CSS

Use an external CSS file, called pink.css. Just type away your CSS in notepad, save to your webdirectory.. and link it into your HTML file, using the <link> tag.

In your html file write:

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

Way 2: Embed CSS in <head>

Embed the CSS inside the HTML file. Somewhere convinient, e.g. within the <head> tag, write the following:

<style>
p {
color: pink;
size: 10pt;
}
</style>


Way 3: Inline CSS as an Attribute of HTML

Embed the CSS inside the tag, specific to that tag only. This way doesn't require the { } definition. Simply type your atrributes, separating them with ; 's

<p style="color: pink; size: 10pt;">

 


Author: Markavian
Last edited on: 5th Dec, 6:53 pm
Please rate this article.

« Prev page 'CSS Syntax' « » Next Page 'Selectors' »

tutorial Pages