JSFiddle - React, Tailwind, and code Playground
by mowglisanu
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample</title>
<meta name="description" content=""></meta>
<meta name="keywords" content=""></meta>
<meta name="robots" content="index, follow"></meta>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<link rel="stylesheet" href="sample.css"
type="text/css" title="Sample Style" media="screen, print"></link>
<link rel="stylesheet" href="dropdown-menu.css"
type="text/css" />
<script type="text/javascript" src="dropdown-menu.js"></script>
</head>
<body style="align: CENTER;">
<div id=main style="width: 960px; margin: 0 auto;">
<div id=header>
<div id="navigation-div" style="padding-bottom: 5px; margin-bottom: 5px;">
<!-- <span class="preload1"></span> <span class="preload2"></span> -->
<ul id="navigation-ul"
style="display:inline-block; border: 1px solid #D1D1D1; margin-left: 0px; border-radius: 5px;">
<li class="top" style="border-radius: 5px 0 0 5px;"><a
class="top_link" href="/index">Home</a></li>
<li class="top"><a id="Solutions" class="top_link down"
href="/solutions"><span class="down">Solutions</span></a>
<ul class="sub">
<li><a class="fly" href="/solutions/business">Business
Solutions</a>
<ul>
<li><a href="/solutions/business/investment-decision">Investment
Decisions</a></li>
<li><a href="/solutions/business/product-mgmt">Product
Management</a></li>
</ul></li>
<li><a class="fly" href="/solutions/software">Software
Solutions</a></li>
<li><a class="fly" href="/solutions/engineering">Engineering
Solutions</a></li>
...
CSS
#navigation-ul {
padding: 0;
margin: 0;
list-style: none;
height: 35px; /* this height must match the #navigation-ul li.top height */
position: relative;
z-index: 200;
font-family: Arial,Helvetica,sans-serif;
}
#navigation-ul li.top {
display: block;
float: left;
height: 35px;
width: 150px;
/* This was the original size
height: 30px;
width: 100px;
*/
background-color: #E1E1E3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFFFF",
endColorstr="#C4C4C4" ); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF),
to(#C4C4C4) ); /* for webkit browsers */
background: -moz-linear-gradient(top, #FFFFFF, #C4C4C4);
/* for firefox 3.6+ */
border-right: 4px groove #D1D1D1;
}
#navigation-ul li a.top_link {
display: block;
float: left;
height: 100%;
width: 100%;
line-height : 33px;
color: #003570;
text-decoration: none;
font-size: 14px;
font-weight: bold;
padding: 0;
cursor: pointer;
text-align: center;
line-height: 33px;
}
#navigation-ul li a.top_link span {
color: #003570;
font-size: 14px;
float: left;
display: block;
padding: 0;
height: 100%;
width: 100%;
}
#navigation-ul li a.top_link span.down {
color: #003570;
font-size: 14px;
float: left;
display: block;
padding: 0;
height: 100%;
width: 100%;
}
#navigation-ul li:hover a.top_link {
height: 100%;
color: #FF0000;
text-decoration: underline;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#C4C4C4",
endColorstr="#FFFFFF" ); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#C4C4C4),
to(#FFFFFF) ); /* for webkit browsers */
background: -moz-linear-gradient(top, #C4C4C4, #FFFFFF);
/* for firefox 3.6+ */
}
#navigation-ul li:hover a.top_link span {
height: 150%;
color: #FF0000;
text-decoration: underline;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#C4C4C4",
endColorstr="#FFFFFF" ); /* for IE...
JavaScript
SampleHover = function() {
var cssRule;
var newSelector;
for (var i = 0; i < document.styleSheets.length; i++) {
for (var j = 0; j < document.styleSheets[i].rules.length ; j++) {
cssRule = document.styleSheets[i].rules[j];
if (cssRule.selectorText.indexOf("li:hover") != -1) {
newSelector = cssRule.selectorText.replace(/li:hover/gi, "li.hover");
document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
}
}
}
var liElements = document.getElementById("navigation-ul").getElementsByTagName("li");
for ( var i = 0; i < liElements.length; i++ ) {
liElements[i].onmouseover = function() {
this.className = this.className + " hover";
};
liElements[i].onmouseout = function() {
this.className = this.className.replace(new RegExp(" hover\\b"), "");
};
}
};
if (window.attachEvent) {
window.attachEvent("onload", SampleHover);
}