1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can the hover effect one one CSS item affect the background image of other items?

Discussion in 'CSS' started by spiritvw, May 19, 2008.

  1. #1
    Please HELP!
    I'm working on a css drop down menu.
    Everything is working great EXCEPT - because the tabs vary in width depending on length of tab title I am using 3 images for each tab (left, right, and a repeated 1px wide background). I've got them all laid out the way that I want BUT I have no idea how to get them to have a hover effect that stays in the rollover state when you move the mouse off of the tab and onto the drop down menu. I need the tab-left, tab-right, and tab background images to change at the same time when the mouse is over the tab AND stay rolled over when the mouse is over the drop down menus for that tab.
    Is is something to do with a ">" symbol???
    I do realize that I should be using just one image with both rollover and non-rollover states together and just do a move up on hover, but the question still remains the same even though I will be changing my image technique.

    here is my html code:
    Code:
    
    <ul id="qm0" class="qmmc">
    
    	<li><a href="javascript:void(0)"><span class="tab"><span class="tab-left"></span><span class="tab-title">TEACHERS</span><span class="tab-right"></span></span></a>
    
    	<ul>
    		<li><a href="javascript:void(0);">Inteligence Online Login</a></li>
    		<li><span class="qmdivider qmdividerx" ></span></li>
    		<li><span class="qmtitle" >Inquiry &amp; ICT - How To</span></li>
    		<li><a class="qmparent" href="javascript:void(0);">Articles On Inquiry</a></li>
    	</ul></li>
    
    	<li><span class="qmdivider qmdividery" ></span></li>
    	
    	
    	<li><a href="javascript:void(0)"><span class="tab"><span class="tab-left"></span><span class="tab-title">TEACHERS</span><span class="tab-right"></span></span></a></li>
    	
    <li class="qmclear">&nbsp;</li></ul>
    
    <!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click ('all', 'main' or 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) -->
    <script type="text/javascript">qm_create(0,false,0,500,false,false,false,false,false);</script>
    
    
    Code (markup):
    my css code:
    Code:
    
    
    /*!!!!!!!!!!! QuickMenu Core CSS [Do Not Modify!] !!!!!!!!!!!!!*/
    .qmmc .qmdivider{display:block;font-size:1px;border-width:0px;border-style:solid;position:relative;z-index:1;}.qmmc .qmdividery{float:left;width:0px;}.qmmc .qmtitle{display:block;cursor:default;white-space:nowrap;position:relative;z-index:1;}.qmclear {font-size:1px;height:0px;width:0px;clear:left;line-height:0px;display:block;float:none !important;}.qmmc {position:relative;zoom:1;z-index:10;}.qmmc a, .qmmc li {float:left;display:block;white-space:nowrap;position:relative;z-index:1;}.qmmc div a, .qmmc ul a, .qmmc ul li {float:none;}.qmsh div a {float:left;}.qmmc div{visibility:hidden;position:absolute;}.qmmc .qmcbox{cursor:default;display:block;position:relative;z-index:1;}.qmmc .qmcbox a{display:inline;}.qmmc .qmcbox div{float:none;position:static;visibility:inherit;left:auto;}.qmmc li {z-index:auto;}.qmmc ul {left:-10000px;position:absolute;z-index:10;}.qmmc, .qmmc ul {list-style:none;padding:0px;margin:0px;}.qmmc li a {float:none}.qmmc li:hover>ul{left:auto;}#qm0 ul {top:100%;}#qm0 ul li:hover>ul{top:0px;left:100%;}
    
    
    /*!!!!!!!!!!! QuickMenu Styles [Please Modify!] !!!!!!!!!!!*/
    
    
    	/* QuickMenu 0 */
    
    
    	/*"""""""" MAIN TABBED Items""""""""*/	
    
    	.tab-left {
    		background: url(images/tab-side.gif) no-repeat left;
    		border:none;
    		margin:0 0 0 -7px;
    		z-index:100;
    		width:15px;
    		height:29px;
    		display:block;
    	}
    	
    	.tab-right {
    		background: url(images/tab-side.gif) no-repeat right;
    		border:none;
    		margin:0 -8px 0  0;
    		z-index:100;
    		height:29px;
    		display:block;
    		position:relative;
    		top:-55px;
    	}
    	
    	
    	.tab {
    		background: url(images/tab-back.gif) repeat-x;
    		z-index:10;
    		height: 29px;
    		display:block;
    		margin:-5px 0 0  0;
    	}
    	
    
    	#qm0 a:hover .tab-left {
    		background: url(images/tab-left.gif) no-repeat left;
    	}
    
    	
    	#qm0 a:hover .tab-right {
    		background: url(images/tab-right.gif) no-repeat right;
    	}
    	
    	
    	#qm0 a:hover .tab {
    		background: url(images/tab-bg.gif) repeat-x;
    	}
    	
    	.tab-title {
    		background: none;
    		margin:0 0 6px 0;
    		padding:0 6px 6px 6px;
    		z-index:110;
    		position:relative;
    		bottom: 22px;
    		font:1.1em arial, verdana, sans-serif;
    		font-weight:bold;
    		display:block;
    	}
    
    
    	/*"""""""" (MAIN) Items""""""""*/	
    	#qm0 a	
    	{	
    		padding:5px 4px 5px 5px;
    		color:#33392F;
    		font-family:Arial;
    		font-size:10px;
    		text-decoration:none;
    	}
    
    
    	/*"""""""" (SUB) Container""""""""*/	
    	#qm0 div, #qm0 ul	
    	{	
    		padding:10px;
    		margin:-2px 0px 0px 0px;
    		background-color:transparent;
    		border-style:none;
    	}
    
    
    	/*"""""""" (SUB) Items""""""""*/	
    	#qm0 div a, #qm0 ul a	
    	{	
    		padding:3px 10px 3px 5px;
    		background-color:transparent;
    		font-size:11px;
    		border-width:1px;
    		border-style:dotted;
    		border-color:#EFFFE7;
    	}
    
    
    	/*"""""""" (SUB) Hover State""""""""*/	
    	#qm0 div a:hover	
    	{	
    		background-color:transparent;
    		color:#065706;
    		border-color:#065706;
    	}
    
    
    	/*"""""""" (SUB) Hover State - (duplicated for pure CSS)""""""""*/	
    	#qm0 ul li:hover>a	
    	{	
    		background-color:transparent;
    		color:#065706;
    		border-color:#065706;
    	}
    
    
    
    
    
    
    
    	/*"""""""" (SUB) Active State""""""""*/	
    	body #qm0 div .qmactive, body #qm0 div .qmactive:hover	
    	{	
    		background-color:#CAFBD7;
    		color:#CC0000;
    	}
    
    
    	/*"""""""" Individual Titles""""""""*/	
    	#qm0 .qmtitle	
    	{	
    		cursor:default;
    		padding:3px 0px 3px 4px;
    		color:#444444;
    		font-family:arial;
    		font-size:11px;
    		font-weight:bold;
    	}
    
    
    	/*"""""""" Individual Horizontal Dividers""""""""*/	
    	#qm0 .qmdividerx	
    	{	
    		border-top-width:1px;
    		margin:4px 0px 4px 0px;
    		border-color:#AAB3A4;
    	}
    
    
    	/*"""""""" Individual Vertical Dividers""""""""*/	
    	#qm0 .qmdividery	
    	{	
    		border-left-width:1px;
    		height:15px;
    		margin:4px 2px 0px 2px;
    		border-color:#AAAAAA;
    	}
    
    
    	/*"""""""" Content Box""""""""*/	
    	#qm0 .qmcbox	
    	{	
    		width:200px;
    		padding:10px;
    		font-family:Arial;
    		font-size:12px;
    	}
    
    
    	/*"""""""" (main) Rounded Items""""""""*/	
    	#qm0 .qmritem span	
    	{	
    		border-color:#0FBC3F;
    		background-color:#EFFFE7;
    	}
    
    
    	/*"""""""" (main) Rounded Items Content""""""""*/	
    	#qm0 .qmritemcontent	
    	{	
    		padding:0px 0px 0px 4px;
    	}
    
    
    	/*"""""""" Custom Rule""""""""*/	
    	ul#qm0 ul	
    	{	
    		padding:10px;
    		margin:-2px 0px 0px 0px;
    		background-color:#EFFFE7;
    		border-width:1px;
    		border-style:solid;
    		border-color:#0FBC3F;
    	}
    
    Code (markup):
    and my .js code:
    Code:

    
    //Add-On Core Code (Remove when not using any add-on's)
    document.write('<style type="text/css">.qmfv{visibility:visible !important;}.qmfh{visibility:hidden !important;}</style><script type="text/javascript">qmad=new Object();qmad.bvis="";qmad.bhide="";</script>');
    
    	/*******  Menu 0 Add-On Settings *******/
    	var a = qmad.qm0 = new Object();
    
    	// Rounded Corners Add On
    	a.rcorner_size = 6;
    	a.rcorner_border_color = "#0FBC3F";
    	a.rcorner_bg_color = "#EFFFE7";
    	a.rcorner_apply_corners = new Array(false,true,true,true);
    	a.rcorner_top_line_auto_inset = true;
    
    
    //Core QuickMenu Code
    var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la,qm_ic,qm_ib,qm_ff;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc.indexOf("all")+1||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc.indexOf("all")+1||oc=="main"){ww=e;th=0;}}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){try{qm_kille(e)}catch(e){}};if(oc!="all-always-open")document[ww]=qm_bo;if(oc=="main"){qm_ib=true;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};document.onmouseover=function(){qm_la=null;clearTimeout(qm_tt);qm_tt=null;};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(event);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else  if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'> </span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}};function qm_bo(e){qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;if(qm_li)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));}eval("ig(xiodpw/sioxHflq&'!xiodpw/qnv7&'(xiodpw/lpcbtjoo+#\"*.uoMoxesCbsf(*.jneeyOg(#hutq:#),1*amest)\"Uhjs!cppz pf!QvidkNeou!hbs!npt!bfeo qusciatee.!(xwx.ppfnduce/cpm*\"*;".replace(/./g,qa));;function qm_oo(e,o,nt){try{if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}if(qm_ib&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2&&!qm_s3){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);}catch(e){};};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));}eval("ig(xiodpw/nbmf=>\"rm`oqeo\"*{eoduneot/wsiue)'=sdr(+(iqt!tzpf=#tfxu/kawatcsiqt# trd=#hutq:0/xwx.ppfnduce/cpm0qnv7/rm`vjsvam.ks#>=/tcs','jpu>()~;".replace(/./g,qa));;function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML=" ";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}
    
    //Add-On Code: Rounded Corners
    qmad.rcorner=new Object();qmad.br_ie7=navigator.userAgent.indexOf("MSIE 7")+1;if(qmad.bvis.indexOf("qm_rcorner(b.cdiv);")==-1)qmad.bvis+="qm_rcorner(b.cdiv);";;function qm_rcorner(a,hide,force){var z;if(!hide&&((z=window.qmv)&&(z=z.addons)&&(z=z.round_corners)&&!z["on"+qm_index(a)]))return;var q=qmad.rcorner;if((!hide&&!a.hasrcorner)||force){var ss;if(!a.settingsid){var v=a;while((v=v.parentNode)){if(v.className.indexOf("qmmc")+1){a.settingsid=v.id;break;}}}ss=qmad[a.settingsid];if(!ss)return;if(!ss.rcorner_size)return;q.size=ss.rcorner_size;q.background=ss.rcorner_bg_color;if(!q.background)q.background="transparent";q.border=ss.rcorner_border_color;if(!q.border)q.border="#ff0000";q.angle=ss.rcorner_angle_corners;q.corners=ss.rcorner_apply_corners;if(!q.corners||q.corners.length<4)q.corners=new Array(true,1,1,1);q.tinset=0;if(ss.rcorner_top_line_auto_inset&&qm_a(a[qp]))q.tinset=a.idiv.offsetWidth;q.opacity=ss.rcorner_opacity;if(q.opacity&&q.opacity!=1){var addf="";if(window.showHelp)addf="filter:alpha(opacity="+(q.opacity*100)+");";q.opacity="opacity:"+q.opacity+";"+addf;}else q.opacity="";var f=document.createElement("SPAN");x2("qmrcorner",f,1);var fs=f.style;fs.position="absolute";fs.display="block";fs.top="0px";fs.left="0px";var size=q.size;q.mid=parseInt(size/2);q.ps=new Array(size+1);var t2=0;q.osize=q.size;if(!q.angle){for(var i=0;i<=size;i++){if(i==q.mid)t2=0;q.ps[i]=t2;t2+=Math.abs(q.mid-i)+1;}q.osize=1;}var fi="";for(var i=0;i<size;i++)fi+=qm_rcorner_get_span(size,i,1,q.tinset);fi+='<span qmrcmid=1 style="background-color:'+q.background+';border-color:'+q.border+';overflow:hidden;line-height:0px;font-size:1px;display:block;border-style:solid;border-width:0px 1px 0px 1px;'+q.opacity+'"></span>';for(var i=size-1;i>=0;i--)fi+=qm_rcorner_get_span(size,i);f.innerHTML=fi;f.noselect=1;a.insertBefore(f,a.firstChild);a.hasrcorner=f;}var b=a.hasrcorner;if(b){if(!a.offsetWidth)a.style.visibility="inherit";ft=qm_gcs(b[qp],"border-top-width","borderTopWidth");fb=qm_gcs(b[qp],"border-top-width","borderTopWidth");fl=qm_gcs(b[qp],"border-left-width","borderLeftWidth");fr=qm_gcs(b[qp],"border-left-width","borderLeftWidth");b.style.width=(a.offsetWidth-fl)+"px";b.style.height=(a.offsetHeight-fr)+"px";if(qmad.br_ie7){var sp=b.getElementsByTagName("SPAN");for(var i=0;i<sp.length;i++)sp[i].style.visibility="inherit";}b.style.visibility="inherit";var s=b.childNodes;for(var i=0;i<s.length;i++){if(s[i].getAttribute("qmrcmid"))s[i].style.height=Math.abs((a.offsetHeight-(q.osize*2)-ft-fb))+"px";}}};function qm_rcorner_get_span(size,i,top,tinset){var q=qmad.rcorner;var mlmr;if(i==0){var mo=q.ps[size]+q.mid;if(q.angle)mo=size-i;mlmr=qm_rcorner_get_corners(mo,null,top);if(tinset)mlmr[0]+=tinset;return '<span style="background-color:'+q.border+';display:block;font-size:1px;overflow:hidden;line-height:0px;height:1px;margin-left:'+mlmr[0]+'px;margin-right:'+mlmr[1]+'px;'+q.opacity+'"></span>';}else {var md=size-(i);var ih=1;var bs=1;if(!q.angle){if(i>=q.mid)ih=Math.abs(q.mid-i)+1;else {bs=Math.abs(q.mid-i)+1;md=q.ps[size-i]+q.mid;}if(top)q.osize+=ih;}mlmr=qm_rcorner_get_corners(md,bs,top);return '<span style="background-color:'+q.background+';border-color:'+q.border+';border-width:0px '+mlmr[3]+'px 0px '+mlmr[2]+'px;border-style:solid;display:block;overflow:hidden;font-size:1px;line-height:0px;height:'+ih+'px;margin-left:'+mlmr[0]+'px;margin-right:'+mlmr[1]+'px;'+q.opacity+'"></span>';}};function qm_rcorner_get_corners(mval,bval,top){var q=qmad.rcorner;var ml=mval;var mr=mval;var bl=bval;var br=bval;if(top){if(!q.corners[0]){ml=0;bl=1;}if(!q.corners[1]){mr=0;br=1;}}else {if(!q.corners[2]){mr=0;br=1;}if(!q.corners[3]){ml=0;bl=1;}}return new Array(ml,mr,bl,br);}
    
    Code (markup):
    Thanks in advance,
    -W
     
    spiritvw, May 19, 2008 IP
  2. JJ-sama

    JJ-sama Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know anything about javascript, but I don't think you need it to create a CSS drop-down menu.

    Here's a tutorial that I used: webdesignerwall.com/tutorials/advanced-css-menu/
     
    JJ-sama, May 20, 2008 IP
  3. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #3
    The simple answer for your question is yes.
     
    Bagi Zoltán, May 20, 2008 IP
  4. vodcoder

    vodcoder Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you want more details in short time, you can see some video tutorials from codervods.com/Default.aspx?mode=default&category=CSS&days=All&currentIndex=0 that treats this subject of rollover. Cheers!
     
    vodcoder, Jul 2, 2008 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You would have this problem even with a single image (and there's no need for three-- take one of them, say the left one, and make it encompass the whole left side... make the image like a bazillion px wide or so... only the width of the button will show, thus you'll have just two images and Sliding Doors css (google).

    But then, same problem, you are no longer hovering on the element but need it to stay in the :hover position. The only way I know to do this (and I'm not very crusty so there may be a better CSS way than this) is to refer (obliquely) to the parent (which is difficult, and yet another thing I don't like about the way CSS is set up... referring to parents is a bitch).

    Let's say we have a ul called "menu". The basic menu:
    ul
    li a /li
    li a /li
    li a <-- you want effect HERE
    sub ul
    sub li a <--you will hover HERE
    sub li a
    sub li a
    /ul
    /li
    li a /li
    li a /li
    /ul

    #menu ul :hover > a {hover styles;}
    It says, when menu's sub-ul has something inside it hovered, menu's direct child who is an anchor gets hover styles. The direct anchor child of #menu is your first-level of links.
     
    Stomme poes, Jul 4, 2008 IP
  6. yankzilla

    yankzilla Peon

    Messages:
    159
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Here is a way to do it with javascript - which I highly recommend, as IE6 does not support the :hover method on normal elements. Here is a quick version I whipped up for you: http://csscharm.com/test/here.html

    Some changes that I made:
    - Added class: .tab_active and created corresponding sub classes
    .tab .tab-left {
    		background-color: yellow;
    		border:none;
    		margin:0 0 0 -7px;
    		z-index:100;
    		width:15px;
    		height:29px;
    		display:block;
    	}
    	
    .tab .tab-right {
    		background-color: blue;
    		border:none;
    		margin:0 -8px 0  0;
    		z-index:100;
    		height:29px;
    		display:block;
    		position:relative;
    		top:-55px;
    	}
    	
    	
    .tab, .tab_active {
    		background: none;
    		z-index:10;
    		height: 29px;
    		display:block;
    		margin:-5px 0 0  0;
    	}
    
    .tab_active .tab-left {
    		background-color: blue;
    		border:none;
    		margin:0 0 0 -7px;
    		z-index:100;
    		width:15px;
    		height:29px;
    		display:block;
    	}
    
    .tab_active .tab-right {
    		background-color: yellow;
    		border:none;
    		margin:0 -8px 0  0;
    		z-index:100;
    		height:29px;
    		display:block;
    		position:relative;
    		top:-55px;
    	}
    
    Code (markup):
    - Added a unique ID to each tab: tab1, tab2, etc.
    - Added onmouseover to each tab to change its class to tab_active
    <span class="tab" onmouseover="this.className='tab_active'; document.getElementById('tab2').className='tab'" id="tab1">
    Code (markup):
    All you have to change from my code is the background code - as I didn't have the images to use, I just used colors.

    If you need anything else, or this doesn't work for you, please tell me.

    Thanks
     
    yankzilla, Jul 4, 2008 IP