This is the file Tree:
-page folder
--main.html
--style.css
--english
---hello.htm
--spanish
---hola.htm

How can I make hola.htm or hello.htm link the style.css in the parent folder?

Dani AI

Generated

The replies from and are correct for the folder layout in the original post, and ’s follow-up confirms the approach works in practice. Below are practical notes and troubleshooting checks that aren’t in the thread — things that commonly cause the stylesheet to silently fail even when the link looks right. (developer.mozilla.org)

  • Verify the resolved URL and HTTP response first: open the stylesheet URL directly in the browser or watch the Network panel in DevTools for a 404 or other errors. That shows whether the browser can reach the file and what Content-Type the server returned.
  • Check server MIME type and security headers: CSS must be served as text/css, and X-Content-Type-Options: nosniff can block a stylesheet if the MIME type is wrong. If the server is misconfigured the browser may ignore the file. (developer.mozilla.org)
  • Remember platform differences: filenames are case-sensitive on most Linux web hosts but not on Windows; file permissions and deployment paths also matter.
  • If styles still don’t apply, hard-refresh or add a cache-busting query string (for example ?v=1.2) while debugging.

If you want alternatives to avoid relative-path bookkeeping, you can use a site-root (leading slash) or absolute URL. Example patterns:

<link rel="stylesheet" href="/page/style.css">
<link rel="stylesheet" href="https://example.com/page/style.css">

Be cautious with a <base> element: it changes how all relative URLs are resolved, so it can break previously-working relative links unless you intend that behavior. For details on base URL rules and how relative references are resolved, see the URL/base documentation. (developer.mozilla.org)

Short checklist: open the CSS URL, check DevTools for 404/Content-Type, confirm server case/permissions, test with a root/absolute link, and clear cache. These steps find the usual causes quickly and keep the simple folder layout working reliably.

Recommended Answers

All 4 Replies

If it is 1 directory above use ../(filename) (the two dots mean go 1 ditecory above)

<link href="../style.css" rel="stylesheet" type="text/css" />

jbennet, Thank you so much! It worked perfectly!

I'm guessing you found the thread via Google Search, Jkreifels.

From here on out, try not to "bump" topics over 3 years old.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.