bjs Posted April 24, 2004 Posted April 24, 2004 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! Quote
LisaJill Posted April 24, 2004 Posted April 24, 2004 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. =) Quote
schussat Posted April 24, 2004 Posted April 24, 2004 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. Quote
bjs Posted April 24, 2004 Author Posted April 24, 2004 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.