0

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?

3
  • If your index file inside public_html you can referencing like this <link rel="stylesheet" href="library/homepagecss.css"> Commented Feb 24, 2017 at 18:58
  • i have 2 directories. public_html and library. So if the css file isn't in the public_html directory, how can I reference it in the libary directory instead? Commented Feb 24, 2017 at 19:00
  • Ok what i know is you can not put your css file out side the public_html that's what i know so if your index file is for example in the homepage <dir> and your css file in a dir called CSS you can referencing by link it with the full path i hope i help you and wait for the other's maybe you find your answer. Commented Feb 24, 2017 at 19:05

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.