| Coding Forum Problems with your code? Let's hear about it. |
05-05-2008, 09:07 AM
|
#1 (permalink)
|
|
Junior Member
Join Date: 05-05-08
Posts: 9
Latest Blog: None
|
Stuck in CSS
Hi,
I've been building this site using html and have been trying for days to make the navigation menu work using CSS. I hit roadblocks constantly and can't figure it out. Here is a link of what I have so far: http://eccolo.com/Site2/ and what I need it to look like: http://eccolo.com/Site2/Site_Ref.jpg
can someone direct me in the right way as to building this navigation menu? or help me code it.
I am open to building it in another coding language if there are suggestions.
Thank you
|
|
|
05-05-2008, 10:04 AM
|
#2 (permalink)
|
|
Contributing Member
Join Date: 04-22-08
Posts: 119
Latest Blog: None
|
could you post the code your working with plz.. i'll see if i can help u out
simplest way i can think of right now is to use css and JS
basically:
CSS:
Code:
#submenu{visibility:hidden;display:none;}
HTML:
Code:
<div id="menuholder">
<div onmouseover='showMenu();' id="menu">MENU</div>
<div id="submenu">SUBMENU</div>
</div>
JS:
Code:
<script>
function showMenu()
{
document.getElementById("submenu").style.visibility="visible";
document.getElementById("submenu").style.display="list";
}
something like that i'd say
Last edited by ag3nt42 : 05-05-2008 at 10:27 AM.
|
|
|
05-05-2008, 10:51 AM
|
#3 (permalink)
|
|
Junior Member
Join Date: 05-05-08
Posts: 9
Latest Blog: None
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Eccolo</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif; background-image:url(images/BGstripe.png); background-repeat:repeat;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.oneColFixCtrHdr #container {
width: 928px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
height: 598px;
margin:52px auto;
border: 0px ;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
background-image: url(images/Header.png);
width: 928px;
height:78px;
/* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
margin: ; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding:; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
width: 928px; background-color:#faedd3;
background-image: url(images/MiddleImage.jpg);
/* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.oneColFixCtrHdr #footer {
background-image:url(images/Footer-main.png); /* this padding matches the left alignment of the elements in the divs that appear above it. */
width: 928px;
height:28px;
}
.oneColFixCtrHdr #footer p {
/* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: ; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
</head>
<body class="oneColFixCtrHdr" onload="MM_preloadImages('images/TodaysSpecials-Down.png','images/ReserveTable-Down.png','images/Nav_OurMenus-Down.png','images/Nav_HoursDirections-Down.png','images/Nav_PrivateEvents-Down.png','images/Nav_Press-Down.png','images/Nav_More-Down.png')">
<div style="z-index:2;" id="container">
<div style="z-index:90" id="header">
<!-- Begin Navigation -->
<div align="right" style="width:65; height:28;">
<a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','OurMenus','im ages/Nav_OurMenus-Down.png',1)" onmouseover="MM_nbGroup('over','OurMenus','images/Nav_OurMenus-Down.png','images/Nav_OurMenus-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_OurMenus-Up.png" alt="Our Menus" name="OurMenus" width="129" height="28" border="0" id="OurMenus" onload="" /></a><a href="/HoursAndDirections" target="_top" onclick="MM_nbGroup('down','group1','HoursDirectio ns','images/Nav_HoursDirections-Down.png',1)" onmouseover="MM_nbGroup('over','HoursDirections',' images/Nav_HoursDirections-Down.png','images/Nav_HoursDirections-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_HoursDirections-Up.png" alt="Hours Directions" name="HoursDirections" width="159" height="28" border="0" id="HoursDirections" onload="" /></a><a href="/PrivateEvents" target="_top" onclick="MM_nbGroup('down','group1','PrivateEvents ','images/Nav_PrivateEvents-Down.png',1)" onmouseover="MM_nbGroup('over','PrivateEvents','im ages/Nav_PrivateEvents-Down.png','images/Nav_PrivateEvents-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_PrivateEvents-Up.png" alt="Private Events" name="PrivateEvents" width="131" height="28" border="0" id="PrivateEvents" onload="" /></a><a href="/Press" target="_top" onclick="MM_nbGroup('down','group1','Press','image s/Nav_Press-Down.png',1)" onmouseover="MM_nbGroup('over','Press','images/Nav_Press-Down.png','images/Nav_Press-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_Press-Up.png" alt="Press" name="Press" width="66" height="28" border="0" id="Press" onload="" /></a><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','More','images/Nav_More-Down.png',1)" onmouseover="MM_nbGroup('over','More','images/Nav_More-Down.png','images/Nav_More-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_More-Up.png" alt="More" name="More" width="65" height="28" border="0" id="More" onload="" /></a> </div>
<!-- End Navigation -->
<!-- end #header --></div>
<div style="height:492px" id="mainContent">
<div style="z-index:50; width:60px; position:relative;
top:-55px; left:887px;">
<a href="http://www.opentable.com/single.aspx?rid=4047&restref=4047" target="_blank" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('ReserveTable','','image s/ReserveTable-Down.png',1)"><img src="images/ReserveTable-Up.png" alt="Reserve Your Table" name="ReserveTable" width="83" height="83" border="0" id="ReserveTable" /></a> </div>
<!-- end #mainContent --></div>
<div style="z-index:10;" align="right" id="footer">
<a href="/TodaysSpecials/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('TodaysSpecials','','ima ges/TodaysSpecials-Down.png',1)"><img src="images/TodaysSpecials-Up.png" alt="Today's Specials" name="TodaysSpecials" width="121" height="27" border="0" id="TodaysSpecials" /></a>
<!-- end #footer --></div>
<!-- Start EccoloLogo -->
<div style="z-index:100; width:330px; position:relative;
top:-647px; left:30px;"><img src="images/EccoloLogo.png" alt="EccoloLogo" />
<!-- end EccoloLogo -->
<!-- end #container -->
</div>
</div>
</body>
</html>
|
|
|
05-06-2008, 12:00 PM
|
#4 (permalink)
|
|
Contributing Member
Join Date: 04-22-08
Posts: 119
Latest Blog: None
|
uh could you post the clean version of this code... sry but i'm not gona sift through a bunch of random code... just post your css and your html maybe your js... but only the code that directly pertains to the menu
Last edited by ag3nt42 : 05-06-2008 at 12:00 PM.
Reason: (sp)fix
|
|
|
05-06-2008, 02:03 PM
|
#5 (permalink)
|
|
Junior Member
Join Date: 05-05-08
Posts: 9
Latest Blog: None
|
For my current navigation I used dreamweaver to begin. I wouldn't mind trashing the whole thing though.
Sorry about that, here is a simplified version:
CSS
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif; background-image:url(images/BGstripe.png); background-repeat:repeat;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.oneColFixCtrHdr #container {
width: 928px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
height: 598px;
margin:52px auto;
border: 0px ;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
background-image: url(images/Header.png);
width: 928px;
height:78px;
/* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
margin: ; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding:; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
width: 928px; background-color:#faedd3;
background-image: url(images/MiddleImage.jpg);
/* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.oneColFixCtrHdr #footer {
background-image:url(images/Footer-main.png); /* this padding matches the left alignment of the elements in the divs that appear above it. */
width: 928px;
height:28px;
}
.oneColFixCtrHdr #footer p {
/* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: ; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
-->
</style>
JAVASCRIPT(I used dreamweaver)
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
HTML
<!-- Begin Navigation -->
<div align="right" style="width:65; height:28;">
<a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','OurMenus','im ages/Nav_OurMenus-Down.png',1)" onmouseover="MM_nbGroup('over','OurMenus','images/Nav_OurMenus-Down.png','images/Nav_OurMenus-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_OurMenus-Up.png" alt="Our Menus" name="OurMenus" width="129" height="28" border="0" id="OurMenus" onload="" /></a>
<a href="/HoursAndDirections" target="_top" onclick="MM_nbGroup('down','group1','HoursDirectio ns','images/Nav_HoursDirections-Down.png',1)" onmouseover="MM_nbGroup('over','HoursDirections',' images/Nav_HoursDirections-Down.png','images/Nav_HoursDirections-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_HoursDirections-Up.png" alt="Hours Directions" name="HoursDirections" width="159" height="28" border="0" id="HoursDirections" onload="" /></a>
<a href="/PrivateEvents" target="_top" onclick="MM_nbGroup('down','group1','PrivateEvents ','images/Nav_PrivateEvents-Down.png',1)" onmouseover="MM_nbGroup('over','PrivateEvents','im ages/Nav_PrivateEvents-Down.png','images/Nav_PrivateEvents-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_PrivateEvents-Up.png" alt="Private Events" name="PrivateEvents" width="131" height="28" border="0" id="PrivateEvents" onload="" /></a>
<a href="/Press" target="_top" onclick="MM_nbGroup('down','group1','Press','image s/Nav_Press-Down.png',1)" onmouseover="MM_nbGroup('over','Press','images/Nav_Press-Down.png','images/Nav_Press-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_Press-Up.png" alt="Press" name="Press" width="66" height="28" border="0" id="Press" onload="" /></a>
<a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','More','images/Nav_More-Down.png',1)" onmouseover="MM_nbGroup('over','More','images/Nav_More-Down.png','images/Nav_More-Down.png',1)" onmouseout="MM_nbGroup('out')"><img src="images/Nav_More-Up.png" alt="More" name="More" width="65" height="28" border="0" id="More" onload="" /></a> </div>
<!-- End Navigation -->
|
|
|
05-07-2008, 05:55 AM
|
#6 (permalink)
|
|
Contributing Member
Join Date: 04-22-08
Posts: 119
Latest Blog: None
|
I tested this code it is working perfectly now mod it to your needs
Code:
<style>
#MainMenu {
background-color:red;
width:100px;
height:25px;
}
#Menu {
background-color:pink;
}
#SubMenu {
background-color:orange;
display:none;
visibility:hidden;
}
</style>
<script>
function displayMenu()
{
document.getElementById('SubMenu').style.visibility="visible";
document.getElementById('SubMenu').style.display="inline";
}
function hideMenu()
{
document.getElementById('SubMenu').style.visibility="hidden";
document.getElementById('SubMenu').style.display="none";
}
</script>
<div id='MainMenu'>
<div id='Menu' onmouseover='displayMenu();' onmouseout='hideMenu();'>
<a href='#'>HOME</a>
<div id='SubMenu'>
<a href='#'>OTHER</a>
<a href='#'>OTHER</a>
<a href='#'>OTHER</a>
<a href='#'>OTHER</a>
<a href='#'>OTHER</a>
<a href='#'>OTHER ect...</a>
</div>
</div>
</div>
|
|
|
05-07-2008, 06:00 AM
|
#7 (permalink)
|
|
v7n Mentor
Join Date: 09-03-07
Location: England
Posts: 528
Latest Blog: None
|
OK, if i was you i'd scrap the Dreamweaver stuff! that's ridiculouse and just makes dumb mark-up!
See here
Boog's
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:44 PM.
© Copyright 2008 V7 Inc
|