Reputation: 9538
Let's say if I link to a background img in a css file url(img/bg.png)
, and the css file is at http://example.com/test/style.css and the img file is at http://example.com/test/img/bg.png
However I browse the page at http://example.com/index.html and i like to the css file via <link rel='stylesheet' type='text/css' href='test/style.css' />
with the base set to <base href="http://example.com" />
Would the css file work?
Upvotes: 1
Views: 101
Reputation: 7483
See this answer: Using relative URL in CSS file, what location is it relative to?
Upvotes: 0
Reputation: 29606
This should work
index.html includes test/style.css , which is a valid link
AND
style.css has /test/
as root so img/bg.png is also valid link
NOTE: as a general convention it's good to include ./
when referring to current directory best choice is to refer images like ./test/bg.png
from your css file
Upvotes: 1