Jump to content

Recommended Posts

Posted

I'm new here and just getting set up. I'm having a problem getting my css stylesheet to show up.

 

My style sheet is located outside of my public html folder like this:

/css/style.css

 

 

The page that isn't showing my stylesheet is here:

/public_html/test.php

 

 

My link to the stylesheet looks like this:

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

 

 

I've tried different paths ( "/css/style.css") and changed the permissions on the /css folder to 777, but it's still not working.

 

Could this have something to do with me not have a real domain name yet? ( I don't want to point my domain to the site until it's ready to go live.) If this is a problem, is there a way to have a fake domain set up until I'm ready to go live?

 

Any help would be much appreciated.

 

Thanks!

Posted

Your stylesheet needs tio be inside of public_html. You could have it in say, public_html/css/ or something such, but if it's in a directory prior to public_html then it's not web accessible.

 

Hope that helps. =)

Posted

Lisa sounds like she's got the fix. To augment it a little bit, if you put your stylesheet in /public_html/css/stylesheet.css, then you call it from your html document as "css/stylesheet.css" (if your document is in /public_html), or as "/css/stylesheet.css", or via any relative path you want (as "../css/stylesheet.css" if the calling document is in a subdirectory of public_html, for instance).

 

In other words, /public_html is the root of all your web documents, so preceding any path with a slash (like "/directory/foobar.html") sends the server looking for a directory relative to that location, rather than your top-level directory. Like Lisa said, anything you want to be seen via the web has to go in public_html or some subdirectory therof.

Posted

Thanks so much. I guess I was assuming that the .html page was 'including' the stylesheet, so that it would essentially be rendered in the public_html folder. I see now that I'm only linking to it.

 

Anyway, I get it now. Thanks again.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...