0

Why does the code below work in IE, but not Firefox or Chrome? Is it the CSS or HTML?

CSS

body  {
background-image:url("\images\body_bg.png");
background-repeat: repeat-x;
background-color:#e0dfe4;
background-attachment: scroll;
background-size: auto;
} 

HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta content="width=device-width, initial-scale=1.0"/>
<title>Program Letters</title>
<link rel="stylesheet" type="text/css" href="../general.css"/>
</head>
<body>...</body>
</html>
Adavid02
  • 189
  • 1
  • 5
  • 20
  • 1
    Do you have a fiddle for us? And what is the expected result? – Huelfe Dec 08 '16 at 15:11
  • 1
    What is not working exactly? – Jeff Dec 08 '16 at 15:15
  • I don't understand your claim that this doesn't work in Chrome or Firefox. You have repeat-x for background-repeat, but then you want background-attachment: scroll (default behavior), and you are setting background-size to auto. Nothing is wrong with your CSS. Are you claiming that your image isn't loading perhaps? If that is what you mean, then check for both path and file name with extension. – Pegues Dec 08 '16 at 15:16
  • 1
    Could the backslash in `url("\images\body_bg.png")` be a culprit? Rough guess. – 31piy Dec 08 '16 at 15:16
  • 1
    Try removing forward slash from the end of link tag. `` and also forward slash from meta tag since they are not allowed in HTML5 – Arpit Svt Dec 08 '16 at 15:18
  • Also check this http://stackoverflow.com/questions/12093540/how-can-i-make-my-css-code-compatible-with-all-browsers – StackUseR Dec 08 '16 at 15:20
  • The background image isnt loading in Firefox or Chrome, but loads in IE. Here is the fidlle https://jsfiddle.net/#&togetherjs=m3yaxURRlB – Adavid02 Dec 08 '16 at 15:29
  • I went to the fiddle, but nothing's there. – Pegues Dec 08 '16 at 17:40

1 Answers1

0

It was a location issue in the CSS. The modified code below fixed it.

 body
{
    background-position: inherit;
    background-image: url("images/body_bg.jpg");
    background-repeat: repeat-x;
    background-color: #e0dfe4;
}
Adavid02
  • 189
  • 1
  • 5
  • 20