Chris Lim
Chris Lim

Reputation: 50

How to reference external css file in file manager - Domain.com

I'm having trouble referencing an external css file in my file manager. My html page is in a folder called "homepage" and my css file is in a folder called "library".

Currently, I have

  <link rel="stylesheet" href="library/homepagecss.css">

but that won't reference the css file.

My only option is to have the homepage html file and css file in the same folder but i'd like to have them separated for organization.

Anyone know how to do this in Domain's file manager?

Upvotes: 0

Views: 581

Answers (2)

cjl750
cjl750

Reputation: 4629

If the homepage of your site is at example.com, and your homepage is in a “homepage” folder, then the href you currently have is going to be looking for a file at example.com/homepage/public_html/library/homepagecss.css. And that’s obviously not correct.

You have two options to fix it.

  1. Use an absolute path to the CSS file: href="http://example.com/library/homepage.css"
  2. Use the HTML <base> tag to set your base path as your homepage in the <head> of your site, and then specify the relative URL in the link to your stylesheet: href="/library/homepagecss.css"

Upvotes: 0

Joan Plepi
Joan Plepi

Reputation: 500

You should either write an absolute path there, like

<link rel="stylesheet" href="C:/User/Documents/public_html/library/homepagecss.css">

(I am assuming your path to the current directory)

BUt if I understood well your both folders library and homepage are in the same folder called public_html you can try this one

<link rel="stylesheet" href="../library/homepagecss.css">

By entering .. you go up in the directory tree, you go up at the parent directory, and you need to go up at public_html cause there is where you library folder is located.

Upvotes: 4

Related Questions