How come I can't incorporate CSS into my html website?

heidegger

New member
I'm trying to use CSS to get a yellow background and purple text, but it never works. I had to use HTML to do it. However, I'd really like to learn how to use CSS. Could you tell me how to add the CSS? I'm a beginner at this. My website is heidegger001.angelfire.com. Right click on it to view the code.
It won't let me put the code on here.
 
there are three ways to put css in your site.
in-line-
very similar to the way you do your html style code. only you but style="css code" for example if you wanted the text of one of your paragraphs to be a different color you would write:
<p style="color:purple"> etc.

you can also put it in the head of your html. so between your opening and closing head tags you would just need to write. also when you do this you'd have to specify what you want the style to effect so if you put body (curly braces always){color:purple;} etc Make sure you follow the right syntax of the language.
<head>
<style type="text/css">
body{
background-color:yellow;}
</style>
</head>

the last way is having your style sheet in another document all together.

you'd write all your css in another document save it as with a .css extension on it then youd have to right, again in the head

<link href="where ever your css file is" rel="stylesheet" type="text/css"/>

just like hyper links if your file is in the same directory or folder you just have to put the name of the file. always remember the extension.

for additional reference or to study up on your html and css check out www.w3schools.com they're pretty good. also it is adviseable to learn the hex codes for colors if you put generic words like purple or yellow the colors will change depending on the browser of the user. best of luck!
 
You can use CSS file with you html in 2 ways.

1. Embedding style tag withing html:
Look where is closing </head> tag. Then just before this tag insert style tag for example:
HTML:
</head>
<style type="text/css">

.styleOne {
font-family: arial;
font-size: 14px;
......
.....
}

#header{
width:940px; height:170px;
margin-left:auto; margin-right:auto;
background: yellow; color:purple; <--------write here color no. #999999
position:relative;
float:left;
</style>
</head>

now in the body tag u can use this div and class selector. for example:
<body>
<div id="header" class="styleOne">
<h1> This is a heading. </h1>
</body> ......................etc.

2. CSS file linking:

First create a style sheet file and save it with name "styles.css".
Then At the same place in html where i previous mentioned
just add this line of code

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

Note: make sure that this styles.css file is in the same folder where in html file.

Hoping this would be solved your problem.

Regards
 
Back
Top