Hi, I am trying to add backgroung-image to body of a webpage. Its working on inline way but noy through css. I tried everything even searched on google. But I don't want where I am making mistake.

<!doctype HTML>
<html>
<head>
<title>Buttons</title>
<link rel = "stylesheet" type = "text/css" href = "assets/stylesheet.css" />
</head>

<body>

</body>
</html>

And here is CSS:

body {
    background-image: url("images/p3.jpg");
}

I also tried:

    body {
        background: url(images/p3.jpg);
    }

But not working!

I asume your CSS is in that stylesheet.css, so then your path to that image should be like this.

body {
    background-image: url("../images/p3.jpg");
}
Member Avatar for diafol

Quick check in your console. If styleheet can't be found this will be stated in the console.

This code is working!

    body {
        background-image: url("../images/p3.jpg");
    }

What was the problem on that codes which I sent? Can you tell me @gentlemedia.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.