• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

Need someone to turn a regular css navigation menu into a drop down menu

Status
Not open for further replies.
have a go with this.. the associated css will need a bit of work to match yours.. but should be a good starting point for you..

java for head tag:
Code:
<script type="text/javascript">
<!--
window.onload=show;
function show(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
//-->
</script>


menu code:
Code:
<div id="menu">
	<dl>
		<dt onmouseover="javascript:show();"><a href="" title="Return to home">Home</a></dt>
	</dl>
	
	<dl>			
		<dt onmouseover="javascript:show('smenu1');">Menu 1</dt>
			<dd id="smenu1">
				<ul>
					<li><a href="#">sub-menu 1.1</a></li>
					<li><a href="#">sub-menu 1.2</a></li>
					<li><a href="#">sub-menu 1.3</a></li>
					<li><a href="#">sub-menu 1.4</a></li>
					<li><a href="#">sub-menu 1.5</a></li>
					<li><a href="#">sub-menu 1.6</a></li>
				</ul>
			</dd>
	</dl>
	
	
	<dl>	
		<dt onmouseover="javascript:show();"><a href="">Menu 2</a></dt>
	</dl>
	
	<dl>	
		<dt onmouseover="javascript:show('smenu3');">Menu 3</dt>
			<dd id="smenu3">
				<ul>
					<li><a href="#">sub-menu 3.1</a></li>
					<li><a href="#">sub-menu 3.2</a></li>
					<li><a href="#">sub-menu 3.3</a></li>
					<li><a href="#">sub-menu 3.4</a></li>
					<li><a href="#">sub-menu 3.5</a></li>
				</ul>
			</dd>
	</dl>
	
	<dl>	
		<dt onmouseover="javascript:show('smenu4');">Menu 4</dt>
			<dd id="smenu4">
				<ul>
					<li><a href="#">sub-menu 4.1</a></li>
					<li><a href="#">sub-menu 4.2</a></li>
					<li><a href="#">sub-menu 4.3</a></li>
				</ul>
			</dd>
	</dl>
	
</div>

css code:

Code:
body {
margin: 0;
padding: 0;
background: white;
font: 80% verdana, arial, sans-serif;
}
dl, dt, dd, ul, li {
margin: 0;
padding: 0;
list-style-type: none;
}
#menu {
position: absolute; /* Menu position that can be changed at will */
top: 0;
left: 0;
z-index:100;
width: 100%; /* precision for Opera */
}
#menu dl {
float: left;
width: 12em;
}
#menu dt {
	cursor: pointer;
	text-align: center;
	font-weight: bold;
	background: #000;
	border: 1px solid red;
	margin: 0px;
	color: #FFFFFF;
	

}
#menu dd {
display: none;
border: 1px solid red;

}
#menu li {
text-align: center;
background: #000;
}
#menu li a, #menu dt a {
color: #FFFFFF;
text-decoration: none;
display: block;
height: 100%;
border: 0 none;
}
#menu li a:hover, #menu li a:focus, #menu dt a:hover, #menu dt a:focus {
background: red;

}
#site {
position: absolute;
z-index: 1;
top : 70px;
left : 10px;
color: #000;
background-color: #ddd;
padding: 5px;
border: 1px solid red; 
}
 
Status
Not open for further replies.
Top Bottom