SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie -background won't show

    I am trying to create a body tag in CSS. I can get it to work within the page but when I link to the CSS page I get nothing. The text formats are correct. How can I do this?


    BODY { color: black;
    background: url(template.jpg);
    font-family: times, "times new roman", symbol, serif;
    }

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using this link in the head of the document

    Code:
    <style type="text/css" media="all">@import "index.css";</style>
    you also might want to check on the font families, I think you have some of them wrong.

    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I'd suggest something on the lines of the following:

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

    Also double check that your directories are correct for both the image and the CSS and you have named and saved your CSS file with the *.css extension.

  4. #4
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the url() function (is it a function?) operates on a URI relative to the document containing it.

    For instance, if you have "url(template.jpg)" in an inline CSS within a document named "/index.html", it will look for a file at "/template.jpg".

    However, if you have "url(template.jpg)" within a CSS file at "/css/main.css", the browser is going to look for the image at "/css/template.jpg".

    The solution is to either use absolute URIs, or else make sure to add a bunch of "../" as necessary in front of the filename.
    ----Adopt-a-Sig----
    Your message here!

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by randem
    the url() function (is it a function?) operates on a URI relative to the document containing it.

    For instance, if you have "url(template.jpg)" in an inline CSS within a document named "/index.html", it will look for a file at "/template.jpg".

    However, if you have "url(template.jpg)" within a CSS file at "/css/main.css", the browser is going to look for the image at "/css/template.jpg".

    The solution is to either use absolute URIs, or else make sure to add a bunch of "../" as necessary in front of the filename.
    I didn't know that ..
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com


Bookmarks

Posting Permissions

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