Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    body-properties in css-file don't take effect

    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..)
    Last edited by maim9; 02-19-2008 at 07:42 PM.

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,179
    Thanks
    174
    Thanked 257 Times in 257 Posts
    have you checked the path to make sure its good, i know you have but i was making sure of it

  • Users who have thanked jcdevelopment for this post:

    maim9 (03-04-2008)

  • #3
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jcdevelopment View Post
    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

  • #4
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    How can we help you without ALL of the code. Html and Css are inter active.

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #5
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jcdevelopment View Post
    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!

  • #6
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,179
    Thanks
    174
    Thanked 257 Times in 257 Posts
    no problem, sometimes it just takes that one item to make everything work!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •