arst06d
Programmer
- Nov 29, 2002
- 324
Hi
I'm trying to implement a tabbed nav solution I picked up on DynamicDrive.com.
Uses UL list styled as 'tabs' with CSS.
However, I want the text on the tabs to split over two lines - and I cannot get it to work:
I have tried
but it gives an odd effect.
I've got the idea that I need to create another div around the text and style that instead of/as well as the <a> but I'm a little lost to be honest.
Your help appreciated!
I'm trying to implement a tabbed nav solution I picked up on DynamicDrive.com.
Uses UL list styled as 'tabs' with CSS.
However, I want the text on the tabs to split over two lines - and I cannot get it to work:
Code:
<html>
<head>
<style type="text/css">
#tablist{
padding: 3px 0;
margin-left: 0;
margin-bottom: 0;
margin-top: 0.1em;
font: bold 12px Verdana;
}
#tablist li{
list-style: none;
display: inline;
margin: 0;
}
#tablist li a{
text-decoration: none;
padding: 3px 0.5em;
margin-left: 3px;
border: 1px solid #778;
border-bottom: none;
background: white;
}
#tablist li a:link, #tablist li a:visited{
color: navy;
}
#tablist li a.current{
background: lightyellow;
}
#tabcontentcontainer{
width:480px;
height:40px;
}
.tabcontent{
display:none;
}
</style>
<script type="text/javascript">
/***********************************************
* DD Tab Menu script- © Dynamic Drive DHTML code library ([URL unfurl="true"]www.dynamicdrive.com)[/URL]
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at [URL unfurl="true"]http://www.dynamicdrive.com/[/URL] for full source code
***********************************************/
//Set tab to intially be selected when page loads:
//[which tab (1=first tab), ID of tab content to display]:
var initialtab=[1, "sc1"]
//Turn menu into single level image tabs (completely hides 2nd level)?
var turntosingle=0 //0 for no (default), 1 for yes
//Disable hyperlinks in 1st level tab images?
var disabletablinks=0 //0 for no (default), 1 for yes
////////Stop editting////////////////
var previoustab=""
if (turntosingle==1)
document.write('<style type="text/css">\n#tabcontentcontainer{display: none;}\n</style>')
function expandcontent(cid, aobject){
if (disabletablinks==1)
aobject.onclick=new Function("return false")
if (document.getElementById){
highlighttab(aobject)
if (turntosingle==0){
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
}
}
}
function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
aobject.className="current"
}
function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}
function do_onload(){
collecttablinks()
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
</script>
</Head>
<body>
<ul id="tablist">
<li><a href="#" onMouseover="expandcontent('sc1', this)">Anne Davies - Chief Executive</a></li>
<li><a href="#" onMouseover="expandcontent('sc2', this)">Christine Roe - Head Honcho</a></li>
<li><a href="#" onMouseover="expandcontent('sc3', this)">Claire Powell - her position</a></li>
<li><a href="#" onMouseover="expandcontent('sc4', this)">Val Blean - Head Buddy</a></li>
</ul>
<DIV id="tabcontentcontainer">
<div id="sc1" class="tabcontent">
blurb about Anne:<br />
</div>
<div id="sc2" class="tabcontent">
Blurb about Chris
</div>
<div id="sc3" class="tabcontent">
Blurb about Claire
</div>
<div id="sc4" class="tabcontent">
Blurb about Val
</div>
</DIV>
</body>
</html>
I have tried
Code:
<li><a href="#" onMouseover="expandcontent('sc1', this)">Anne Davies<br>Chief Executive</a></li>
but it gives an odd effect.
I've got the idea that I need to create another div around the text and style that instead of/as well as the <a> but I'm a little lost to be honest.
Your help appreciated!