Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Problem with file path

Please I having problem the file path in this code. I am just starting the website template from scratch.
I am testing the css file with green background but it is not working


HTML:
<html>
     <style>
          body {
               background-color: green;
          }
     </style>
     <head>
          <link rel="stylesheet" href="/storage/emulated/0/Web/css/style.css">
          <title>latent Data</title>
     </head>
<body>
</body>
</html>
 
Last edited by a moderator:
why don't you specify the path relative to your html/php file?
if your html/php file is in /storage/emulated/0/Web e.g. /storage/emulated/0/Web/index.html then you only need to specify css/style.css
 
Hey there, @darkjohn.

First of all, I've formatted your post so that the code can easily be read. Please read this thread for more information the next time you go to post a snippet of code: https://www.codeforum.org/index.php?threads/how-to-post-your-code-into-threads.183/

Second of all, if you're going to insert CSS code inside of a HTML file, you use: <style>. You can find more information about it here, over on MDN(Mozilla Developer Network - This is actually a good place for documentation so use it if you're stuck): https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style

Side-Note: Going back to me formatting your post, I have done this change for you, but remember to follow the documentation set out in MDN.

For external CSS(So, CSS code that's in it's own .css file), as @Tealk said, if your HTML file is in /storage/emulated/0/web/index.html then you only need to specify: css/style.css for your <link> tag.
 
Hello,

did you find a solution to this problem?

Edit: So first things first you need to decide on how you want to structure your website e.g. do you want to create folders for different functions like js folder, CSS folder (recommended) etc. Next, decide if you want to use either external or internal stylesheet you can view more here. Externally setting up your stylesheet is most recommended, it keeps both HTML & CSS separate and creates less clutter. Then again, you can have both but may cause some conflictions.

Now I can see that you are trying to link to a CSS document. Here are a couple of pointers to look for that you can find in the link above as well.
  • Make sure the CSS document has the extension .css at the end. If it's not, just open the text file and save as [name].css.
  • Make sure the link to your stylesheet is correct. It should be somewhat similar to this: <link href="PATH TO YOUR STYLESHEET" rel="stylesheet" type="text/css">.
  • The link to the CSS document should also be within your <head></head> tags.
And like @Tealk specified:
why don't you specify the path relative to your html/php file?
if your html/php file is in /storage/emulated/0/Web e.g. /storage/emulated/0/Web/index.html then you only need to specify css/style.css
 
Last edited:

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom