PDA

View Full Version : CSS DropDown Menu not working


navyfalcon
11-06-2007, 07:29 PM
Problem: CSS DropDown Menu
Trying to adapt this menu for my website - menu on individual pages
Since it is CSS, it can be used as external style sheets - I will be using
on several pages because content is large and different subtopics.
website: http://freetutorials.name

computer applications > Utilities & drivers
(this is an example, in javascript, of what is to be accomplished in CSS

computer applications > Design & Photo
(this is what I tried and didn't work)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GRC multi-level script-free pure-CSS menuing system stylesheet.
This code is hereby placed into the public domain by its author
Steve Gibson. It may be freely used for any purpose whatsoever.
http://www.grc.com/menu2/invitro.htm
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I tried his example and removed items until I had the minimum
that would work for his example (left menu)
I used his external style sheet without change
problem, I think, is HTML definitions or conflict with other CSS
used to style page. Tried several ways to make it work - didn't work
pages can be seen via view > page source
and external CSS http://www.grc.com/menu2/invitro.htm
external page style css listed below:

* {
margin: 0;
padding: 0;
}
body {
background-color: #FAEBD7;
font-family: "Times New Roman", Times, serif;
font-size: 14px;
color: #000000;
padding: 10px;
}
a:hover {
color: purple;
background-color: white;
font-weight: bold
}
#ads {
min-height: 50px;
text-align: center;
border:1px solid darkblue;
background-color: #FAEBD7;
background-position: 5px center;
}
#banner {
text-align: center;
border:1px solid darkblue;
background-image: url(Images/2R131.gif);
background-repeat: no-repeat;
background-position: 5px center;
}
#banner b {
display: block;
min-height: 120px;
background-image: url(Images/3C331.gif);
background-repeat: no-repeat;
background-position: right center;
margin: 0 5px;
padding: 0 200px;
font-weight: normal;
}
* html #banner b {
height: 120px;
}
#banner h2 {
color: #FF0000;
font-size: 180%;
margin-bottom: 10px;
}
#homelink {
float: left;
width: 64px;
height: 17px;
background-image: url(Images/ltblue-button.gif);
margin-top: 7px;
font-size: 1px;
color: #428AFC;
}
#testlink {
float: right;
width: 64px;
height: 17px;
background-image: url(Images/lt_blue-button.gif);
margin-top: 7px;
font-size: 1px;
color: #3C8FFC;
}
h3 {
text-align: center;
color: #FF0000;
line-height: 30px;
font-size: 130%;
}
.leftcol {
float: left;
width: 49.5%;
padding: 5px 5px 5px 5px;
}
.rightcol {
float: right;
width: 49.5%;
padding: 5px 5px 5px 5px;
}
.leftcol a, .rightcol a
{
margin-left: 5px;
line-height: 1.5ex
}
.leftcol dt, .rightcol dt {
padding-top: 5px;
padding-left: 5px;
}
.leftcol dd, .rightcol dd {
padding: 2px 5px 2px 30px;
}
.leftcol b, .rightcol b {
display: block;
padding: 2px 5px 2px 30px;
}
.leftcol, .rightcol {
border:1px solid darkblue;
margin-bottom: 5px;
}
.clear {
clear: both;
}

jcdevelopment
11-06-2007, 08:45 PM
im not sure if you are asking if a drop down is not working or not. What i saw when i went to the link you supplied, there was no embedded or external css to the page, unless i missed it, and there were no tags for a list anywhere from what i remember....

kosstr12
11-06-2007, 08:59 PM
What exactly is your question...?

Blue_Jeans
11-07-2007, 05:34 AM
I think you want a pure css dropdown menu..?

I have one I made you can feel free to adapt. It's not IE6 compatible, as it doesn't support :hover on non a elements.

<div id="menuh-container">
<div id="menuh">
<ul>
<li><a href="index.php" class="top_parent">District</a>
<ul>
<li><a href="index.php">Main Page</a></li>
<li><a href="index.php?id=staff">Staff</a></li>
<li><a href="index.php?id=boardoftrustees">Board of Trustees</a></li>
<li><a href="index.php?id=contactinformation">Contact Information</a></li>
<li><a href="index.php?id=employment">Employment</a></li>
<li><a href="index.php?id=news">News</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="index-hs.php" class="top_parent">High School</a>
<ul>
<li><a href="index-hs.php">Main Page</a></li>
<li><a href="index-hs.php?id=sports.php" class="parent">Sports</a>
<ul>
<li><a href="index-hs.php?id=football">Football</a></li>
<li><a href="index-hs.php?id=crosscountry">Cross Country</a></li>
<li><a href="index-hs.php?id=volleyball">Volleyball</a></li>
<li><a href="index-hs.php?id=boysbasketball">Boys' Basketball</a></li>
<li><a href="index-hs.php?id=girlsbasketball">Girls' Basketball</a></li>
<li><a href="index-hs.php?id=wrestling">Wrestling</a></li>
<li><a href="index-hs.php?id=softball">Softball</a></li>
<li><a href="index-hs.php?id=track">Track and Field</a></li>
</ul>
</li>
<li><a href="index-hs.php?id=clubs">Clubs</a></li>
<li><a href="index-hs.php?id=lunch">Lunch</a></li>
<li><a href="index-hs.php?id=library">Library</a></li>
<li><a href="index-hs.php?id=news">News and Events</a></li>
<li><a href="index-hs.php?id=staff">Staff</a></li>
<li><a href="index-hs.php?id=studentcouncil">Student Council</a></li>
<li><a href="index-hs.php?id=counseling">Counseling Resources</a></li>
</ul>
</li>
</ul>
</div>
</div>

The CSS (http://icidweb.dnsalias.com/sites/wssd/css/dropdown.css). Also, the classes top_parent and parent are only for my personal styles, they aren't required for functionality.

Also, if you don't rename things, I made a script that will make it compatible for IE6. Right+click on this link (http://icidweb.dnsalias.com/sites/wssd/dropdown.js) and save it to you computer and stick it in where you want. Link to it in your HTML like so:

<!--[if lt IE 7]>
<script language="JavaScript" src="dropdown.js" type="text/JavaScript"></script>
<![endif]-->