I have a CSS-styled HTML drop-down menu that I want common across all web pages. Right now, I have the HTML coding in each file, but the CSS link is broken in subdirectories so the stlying does not work. How can I get the CSS to be linked properly and how could I have a master menu so I only have to change things once? Thanks.

5 Years
Discussion Span
Last Post by iamthesgt

Copy the CSS file to each of your subdirectories.

Also please post your html link to the css file. I am basing my above solution that your html is calling for the file to be within the directory the file is in.

Edited by Lightninghawk: n/a


It is not in the same directory, but the html link is 'relative' - it is down a level.
Here is the link on the master page (index.html):

<link href="css/dropdown/dropdown.css" media="screen" rel="stylesheet"
type="text/css" />
<link href="css/dropdown/themes/default/default.css" media="screen"
rel="stylesheet" type="text/css" />

Yes, the css works for all the top-level directories. The folder layout is like

-css (Folder)
   -img (Folder)
   -subpage1 (Folder)
   -subpage2 (Folder)

The css works for pages "index", "about", "subpage1", and "subpage2". It does not work for those in folders "subpage1" or "subpage2" (i.e. product1, 2, 3, or 4).

Edited by iamthesgt: n/a


What's the link href to the css in the pages that aren't working? It should be something like

<link href="../css/dropdown/dropdown.css" media="screen" rel="stylesheet"
type="text/css" />
<link href="../css/dropdown/themes/default/default.css" media="screen"
rel="stylesheet" type="text/css" />

That worked. I thought I had tried that, but I guess I didn't. Do you know how to make a master menu page so the menu is the same on all pages where I can only change it once?


That can be done using php/mySQL or another scripting language or simply have two files that are the basically the same except that one has "href='../" and the other doesn't. Or use one file with urls for the links (href="http://www.whatever.com/index...)

I assume you are able to use server side includes? If not then PHP will probably be the best route.


I don't know...I'm very new to this, but I will look into that and probably ask some more questions later. Thanks for all your help.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.