Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Can someone help me get my external CSS to work?

I'm trying to get my html file to link with the css file. The css and html files are together and the background the css refers to is in a file within the project file called images

<!DOCTYPE html>

<html>

<head>

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

<title>Cool Cats</title>

</head>

<body>

<p>ljljlj</p>

</body>

</html>

CSS

body {

background: url(".../images/background.jpg");

}

2 Answers

Relevance
  • Chris
    Lv 7
    6 years ago

    From what you describe, the <link> is probably working fine; the issue is more likely the url in your body rule.

    First, make sure the CSS is properly linked:

    body {

    background-color: red;

    /*

    background: url(".../images/background.jpg");

    */

    }

    If that works, fix the url by first trying

    url(../images/background.jpg)

    note the two dots, not three.

    Then try

    url(images/background.jpg)

    this should work if the images folder is next to your css file.

    (You should also start using the developer console. The hands down best implementation is Firefox's FireBug extension.)

  • 6 years ago

    This should fix it: background-image: url(".../images/background.jpg");

    :)

Still have questions? Get your answers by asking now.