htmlcssrelative-path

How to go up a level in the src path of a URL in HTML?


I am storing style sheets in {root}/styles while images in {root}/images for a website. How do I give the path in the style sheets to go look in the images directory for the specified images?

e.g. In background-image: url('/images/bg.png');


Solution

  • Use .. to indicate the parent directory:

    background-image: url('../images/bg.png');