...

View Full Version : body-properties in css-file don't take effect



maim9
02-19-2008, 07:38 PM
Hello,

Thank you for a good forum. I have tried to search, but I can't seem to find any answer to the problem I've encountered. What I'm basically trying to do, is to make the css-file determine all body-properties of my html-documents, but for some reason, this is not working.

I'm sure I must have missed something, but I can't seem to figure out what.

These are the first few lines of the css-file ("stilark.css"):

html { margin: 0;
padding: 0;
}

body {
text-align: center;
background: #000000;
background-image: url(/Grafikk/BGgradient.jpg) repeat-y top left;
}

P { font-family: Verdana, Arial, Sans-serif; font-size: 11px; font-weight: 400; color: #969696; background: transparent; }

A:link { font-weight: 400; font-style: normal; text-decoration: none; text-transform: none; font-variant: normal; color: #C0C0C0; }
A:visited { font-weight: 400; font-style: normal; text-decoration: none; text-transform: none; font-variant: normal; }
A:hover { font-weight: 500; font-style: normal; text-decoration: underline; text-transform: none; font-variant: small-caps; color: #FFFFFF; }


And this is my html file with the body content left out. Sorry I can't give you a "live" example, but I haven't published the page yet.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<title>(tittel)</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="description" content="name" />
<meta name="keywords" content="name" />
<meta name="MSSmartTagsPreventParsing" content="true" />

<style type="text/css"></style>
<link rel="stylesheet" type="text/css" href="elementer/stilark.css" />


</head>
<body bgcolor="#000000" text="#969696" link="#C0C0C0" vlink="#969696" alink="#C0C0C0">
...

</body>
</html>


What happens is that none of the properties applied to the body through the css file display. In this example, it means that the background image doesn't display. The colors display since I include them in the body-tag. Leaving them out, makes a white background, even if colors as well are included in the css.
I'm confused. I've gone through both files word by word and matched them with other functioning pages, but I can't find out what's wrong.

Any help is very much appreciated!


Edit: What's weird and interesting is that the "text-align" property works. All other tags are read and effected by the html-file as well. It's only body-properties related to colors and fonts that I can't make work.. I've tried **any** kind of syntax I can think of (all values in one "background"-line, or a separate "background-image", etc..)

jcdevelopment
02-19-2008, 07:49 PM
have you checked the path to make sure its good, i know you have but i was making sure of it

maim9
02-19-2008, 08:00 PM
have you checked the path to make sure its good, i know you have but i was making sure of it

yeah, and I've also tried both "elementer/stilark.css" and "/elementer/stilark.css", even if I don't know what the difference would be.

I've tested the page in firefox 2, internet explorer 7 and the preview window of the Coffeecup HTML Editor (I don't know what decoding engine they use).

Yes, Coffeecup HTML Editor is the editor where I code my html-files, and so I've also read through the html file in notepad to check if the program left any "special characters" (as their Coffeecup Stylesheet Editor does (I hate that program, a complete waste of $39)) that could potentially cause errors.

Thanks anyway for your suggestion, JCDevelopment

effpeetee
02-19-2008, 08:03 PM
How can we help you without ALL of the code. Html and Css are inter active.

Frank

maim9
02-19-2008, 08:06 PM
have you checked the path to make sure its good, i know you have but i was making sure of it

No, sorry. You are right. I thought I did it right because I entered the path relative to the index.html, not the css-file. I feel so stupid. the css-file and the background-file have different subdirectories to the root directory.

I haven't tested it yet, but I thought I'd call off any others wasting their time on my stupid mistake. Can't believe I just spent a day trying to understand this.

Thank you very much!

jcdevelopment
02-19-2008, 08:09 PM
no problem, sometimes it just takes that one item to make everything work!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum