CandiceJune / prj-rev-bwfs-dasmoto

0 stars 0 forks source link

Use relative paths when loading assets #1

Open zannain opened 6 years ago

zannain commented 6 years ago

Currently, you are connecting your stylesheet to the HTML page via a absolute reference/path. As a result that stylesheet will only work if I have that same path on my machine. Instead, you want to use a relative reference/path

<!-- absolute path -->
<link href="C:\PROJECTS\Dasmotos_Arts_And_Crafts\Resources\style.css" type="text/css" rel="stylesheet">

<!-- relative path -->
<link href="Resources\style.css" type="text/css" rel="stylesheet">

The browser will know to look for a Resources directory inside your project directory to find the style.css stylesheet.

Using an absolute path


image

Using a relative path


image

One way to check that all your assets are being loaded into a webpage is to go to a browsers developer tools (Right Click ➡️ Inspect ➡️ Network ) and you will see that using an absolute path your stylesheet is not being loaded (indicated by the red)

image

CandiceJune commented 6 years ago

Hey there, thanks so much for looking over this. However, I'm not seeing any of the above load on my screen? Its just blank.

image

CandiceJune commented 6 years ago

Hi there, I've figured this out, and I've changed this to a relative path, but for some reason it's still not loading. Can you please advise? Thanks so much

zannain commented 6 years ago

Hey Candice, can you paste the updated link elements with the corrected href attribute and I'll take a look, thanks!

CandiceJune commented 6 years ago

Hey Zannain, I've done that! Let me know what I'm doing wrong! thanks so much!

zannain commented 6 years ago

When you go to the networks tab make sure to hit F5 and see if your stylesheet file is being loaded. It looks like your link href attributes are correct :)