

- #Get simple css not loading update#
- #Get simple css not loading code#
- #Get simple css not loading series#
Configuring Static Files via Middleware.J is for JavaScript, CSS, HTML & Other Static Files.

In this series, we’ll cover 26 topics over a span of 26 weeks from January through June 2019, titled A-Z of ASP.
#Get simple css not loading series#
Is it possible that your browser, or an intervening proxy is caching the file? Try a hard refresh if you web browser has one, or clearing your cache.This is the tenth of a series of posts on ASP. Unlikely, but it can be worth checking that the files have read permissions for the webserver's user. If the path seems right, double-check the case of the directory and filenames - if your server is case-sensitive, it will treat files called Style.css and style.css as different files.Ĭan you browse directly to the file at /css/style.css on your website? "./css/style.css" points one directory up, then down through the css directory. "./style.css" and "style.css" both point to file style.css the same directory as the webpage "./style.css" points one directory up. If you can load the web page which includes the css file, the path will be relative to the web page. The leading / with no dots indicates the root level of the website. The error is a page not found error, which indicates the web server can't find the file it was told to look for at "/css/style.css". Hope this helps some searching soul in future!! Lesson learned - Beware of copy/paste from the internet. On realizing this I changed the quotations in the CSS link: Īnd lo-behold everything started working beautifully (thanks CSS).
#Get simple css not loading code#
I found this because they looked smaller when compared to other quotation marks typed in my code elsewhere and which looked more like: "" While at first glance the code looks perfectly fine, on viewing carefully (which unfortunately I did after hours of googling around) it turns out that the quotation marks I had used (copied from internet code) were not really quotation marks but some other characters. While doing so I linked my CSS file as follows: Since I was new to HTML/CSS I tried to copy some sample code snippets from the internet. Do not want others to go through the same ordeal. I spent hours on trying to solve the problem and in the end, it turned out to be a very trivial thing. I want to post my own version of the answer on this very old thread as I just found a possibly known but 'ignored-after-solving' way of getting into this problem of CSS just refusing to link with the HTML.
#Get simple css not loading update#
If you update your question, I could update my answer further. Like I said, I can't give you the specific answer if I don't know your folder structure. Options 1 and 2 are much better suited for that. Generally speaking, and I think this applies in your case, you'd want a relative path. This type of notation is better used when using an absolute path. So for the given example, the css file will be searched on the following location: Using the leading slash means that the working folder is set to the highest possible parent (which is always the web domain). Suppose your webpage is accessible via the following URL: Now you're working in the root directory of your website (not your page!) You could put href="./././css/style.css", and then you'd be working from the parent of the parent of the parent of your HTML page. So, you need to go up one level, which you accomplish by adding. But the CSS folder and the HTML page's parent are siblings. In this structure, the HTML page and the CSS folder are not siblings. Suppose your folder structure is as follows: - CSS (folder)

Now you're working in the parent directory of the HTML file's location. That means the HTML file and the CSS folder should be siblings.Ģ - Starting dots and slash href="./css/style.css" If there is no prefixed character, you're working in the same directory as your html file.įor the above example, I'd expect the structure to be as follows: - CSS (folder) I'll explain all options you've tried and what they actually do:ġ - No starting dots, no starting slash href="css/style.css"

The issue stems from how you use the path. I can't give you a specific answer as I don't know what your local file structure is like (if you post it in the question, I might be able to give you a direct answer).
