June 18th, 2017, 09:08 PM
-
css Background issue
I have all my CSS in a file, located and referenced like so:
Code:
<link rel="stylesheet" type="text/css" href="./css/main.css" media="screen" />
For everything, it's fine. Except the body background:
Code:
body {
font-family: Helvetica, Arial, sans-serif;
background-image: url("./images/dark.png");
}
...also tried...
Code:
body {
font-family: Helvetica, Arial, sans-serif;
background: url("./images/dark.png") repeat;
}
File paths like so:
/ - main pages
/css/main.css
/images/ - image files
I'm missing something obvious.
Last edited by Arty Zifferelli; June 18th, 2017 at 09:41 PM.
June 18th, 2017, 11:25 PM
-
Relative paths in CSS files are resolved based on the location of the CSS file, so you want your image url to be ../images/dark.png
Recycle your old CD's
If I helped you out, show some love with some reputation, or tip with Bitcoins to
1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
June 18th, 2017, 11:47 PM
-
Originally Posted by kicken
Relative paths in CSS files are resolved based on the location of the CSS file, so you want your image url to be ../images/dark.png
Huh. Is this how it's normally done? Seems wonky.
Also still no background...
[edit]
Code:
body {
font-family: Helvetica, Arial, sans-serif;
background: url("../images/light.png") repeat;
}
...works.
Maybe I should include it as a file...
Last edited by Arty Zifferelli; June 18th, 2017 at 11:57 PM.