can't find correct relative paths of CSS background-image

Viewed 8292

I am studying HTML and CSS right now. And I got issue about relative paths of CSS background-image. My background-image code under CSS doesn't show image when I use relative path.

I am using ATOM code editor. here is the CSS linked code in my HTML file.

<link href="resources\css\style.css" rel="stylesheet" type="text/css">

I try several relative paths, all doesn't work

  1. background-image: url('resources\building.png');
  2. background-image: url('\resources\building.png');
  3. background-image: url('boardway\resources\building.png');
  4. background-image: url('\boardway\resources\building.png');
  5. background-image: url('C:\Users\michael\gitprojects\boardway\resources\building.png');

boardway is parent directory of resources. C:\Users\..\.. is absolute path of image. All five address don't work.

But When I use AWS address which is

background-image: url('https://s3.amazonaws.com/codecademy-content/programs/freelance-one/broadway/images/the-flatiron-building.png');

The background picture are showing correctly. So at least I can sure my code is correct. But I failed to input a correct relative path. What I can do?

2 Answers
Related