1

HOW CAN I LINK THE STYLESHEET FILE IN MY HTML????????? I have struggle with this problem for so many times, yet none of the time I succeed and have to start over. This one single question has had made me got headache so many times in the past, yet I never can solve it.

Comments
  • 6
  • 0
    I mean, link the CSS file in the HTML/Markdown file, like this:

    ```
    <link rel="stylesheet" href="style.css">
    ```

    I always got a 404 for the style.css for some reason and I have tried many sources and none of them is successful. I have checked the server log and it seems like the server/the Python `Markdown` template engine treated the style.css file as a route and I have no idea how to fix this so maybe you guys can help me.

    My brain is literally melting right now.
  • 1
    @NoOneCares check the permissions of the web server. It might be not configured properly to return the file at the path you're using.
  • 2
    Correct directory?
    Permissions?
    Server?

    Are you serving static assets or running everything through Python/markdown/etc. processing first?

    Is there a CSS preprocessor in the way?
  • 1
    Hard to say what's wrong without context, but sounds like you haven't configured a route for static content. Assuming you use Flask https://stackoverflow.com/a/...
  • 2
    @NoOneCares fuck it!

    Do it with inline styles!
  • 1
    @sariel That sucks not only in terms of caching, but will hurt again once you roll out CSP.
  • 1
    @Fast-Nop I guess I should have put that sarcasm tag in.

    Inline styling is good for one thing, fucking over the next guy.
  • 2
    @sariel When reality becomes farce, like in the web dev world, sarcasm is hard to detect. ;-/

    Just look at the Tailwind homepage: a CSS framework (a bad idea in itself), and even that has fucking inline styling.
  • 0
    @Root There are no CSS preprocessor, just pure CSS
  • 0
    @thejase That's the exact link tag I use.
  • 0
    @Root I am serving static assets. First I feed the index page file into a Markdown processor, and then I feed the output into the HTML request of the Python web framework I use (In this case is Sanic).

    And no, I am not wrong about the place where the CSS file exists. It is at the root directory with the Markdown file and the server files.
  • 1
    Idk.
    Threaten it with a tea party.
  • 0
    Ok, so after searching the Sanic doc for a little bit, I think the problem is because I haven't set a URL for my style.css file yet.
  • 1
  • 0
    Ok, have tested on Replit and worked!
  • 1
    @sariel sonc th hdgehok
Add Comment