About Relative Paths for Web Resources

For HTML, the relative paths are relative to the directory of the HTML file:

<!-- /index.html -->
<img alt="" src="img/the-image.jpg" />

For JavaScripts, the relative paths are still relative to the directory of the HTML file:

/* /js/main.js */
var img = new Image();
img.src = 'img/the-image.jpg';

But for CSS, the relative paths are relative to the directory of the CSS file:

/* /css/main.css */
body {
    background: url(../img/the-image.jpg);
}

Tips and Tricks Web Design JavaScript HTML5 CSS3 CSS2

Django/Python Consulting

If you have a specific Django challenge or integration you'd like to solve, I'd be happy to help. Book a free 30-minute call to discuss your project, see if we're a good fit, and explore the best approach for your needs. After the call, you'll receive a tailored cost estimate based on what we discuss.