Am trying to learn web development by creating a website my own instead learning every single theory written on a textbook.
Currently am trying to link a stylesheet and favicon on my root folder into the file called debian.html and debian-post-install.html. But it’s not working and I don’t know why.
code used inside both html files head section are,
<link rel="stylesheet" href="/styles/style.css" />
<link rel="icon" type="image/png" href="/images/favicon.png" />
To point to the root directory files or directories we use / in html instead of ../ right? Then why it’s not working.
Also I need advice on how bad is my html file structuring and what changes recommended.
Solution
<link rel="stylesheet" href="../../styles/style.css" />
<link rel="icon" type="image/png" href="../../images/favicon.png" />


Paths don’t have to start with either of those. Just “styles/mystuff.css” is perfectly valid.
If you start with / the server looks at whatever IT thinks the root folder is, which may not even be visible to your app or site. That’s not what you want most of the time.
Even at the command prompt you can do “cd styles” without any / or … at all. Try it. If you really want you can probably use “./styles”, where the single dot means the current directory. But you really shouldn’t need it.
When debian.html is loaded, href in it looks at current path, so . would be something like http://website.com/linux-guides/debian There is no styles.css in that path, but we can request href to point to http://website.com/styles.css with a few …/…/
I think its not a good practice these days, but on pure html site and for learning, definitely valid.