HTML font-changes with CSS

I've been teaching myself HTML to make web pages, and I just started to delve into CSS as well, because the two almost always go hand-in-hand (according to various sources including Wikipedia). So, I've been experimenting with CSS to alter font styles. I have made a HTML program that links with a separate CSS stylesheet.

So, the issue I'm having is, when I try to modify the body-text with this CSS stylesheet:
1
2
3
4
5
6
7
8
body 
{
	overflow: hidden;
	background-color: #FCDC00;
	background-image: url(images/bg.gif);
	background-repeat: no-repeat;
	background-position: left top;
}

it simply makes the background color black. I wish I could attach a screenshot of it, but I don't know if I can.

Here's the HTML program that uses the stylesheet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<!-- This program links to a CSS stylesheet to modify various properties of the text-->
<html>
	<head>
<!-- This is a link to the CSS stylesheet.
Note: it must be in the same directory as this program, otherwise you need to copy and paste the directory path like so:
 <link href="/directory/path/to/font-types.css" ... >
Or, you can delete the <link> and paste this instead:
 <style>
    <!--CSS code from stylesheet goes here-->
 </style>
-->
		<link href="font-types.css" rel="stylesheet" type="text/css">
	</head>

        <body>
                <p>This is a test-the color should be yellow.</p>
        </body>
</html>

Any help would be greatly appreciated.
Thanks!
max
HTML document.
If that's your actual HTML document, you can't nest HTML comment tags, so it already doesn't make sense.

- If I just remove the comments, I get black text on a gold/yellow-ish background when I load it in my browser.
- If I create a bg.gif within an images folder, I now see my gif, with the same background as before.
Last edited on
Document, yes thank you @helios.

@Ganado,
I think I made a mistake with the comment...this is what I meant to say.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<!-- This program links to a CSS stylesheet to modify various properties of the text-->
<html>
	<head>
<!-- This is a link to the CSS stylesheet.
Note: it must be in the same directory as this program,
 otherwise you need to copy and paste the directory path like so:
 <link href="/directory/path/to/font-types.css" ... >
-->
		<link href="font-types.css" rel="stylesheet" type="text/css">
	</head>

        <body>
                <p>This is a test-the color should be yellow.</p>
        </body>
</html>

I deleted the stuff about copying and pasting <style> in there because the whole point of me asking this was so I could put the CSS code into a separate stylesheet.

Edit:
Well, I guess my messed up comment was the error. Thanks for pointing that out @Ganado!

max
Last edited on
Topic archived. No new replies allowed.