Collected by Elizabeth Janson Home Page |
|
This "bubble" you refer to is kind of a pop-up textbox(usually yellow, done when you hold the cursor over the link for a few seconds right?) They are called Title Boxes.
Use <SPAN style="color:red" TITLE="bubble text">text with title</SPAN>, This section began with a page by Joe Burns of HTMLgoodies fame. He wrote This effect is really simple. In the example below, I use it to give an explanation for the word COBOL. I surround the word by a <SPAN> tag. To make the word stand out, I use CSS within the <SPAN> tag to make the word underlined and blue. The cursor is a hand when hovered over. Notice that I have inserted two non-breaking spaces after the word COBOL. <SPAN TITLE="COBOL is an acronym that stands for Common Business Oriented Language" STYLE="color: navy; text-decoration: underline; cursor: hand; background-image: url(question.gif); background-repeat: no-repeat; background-position: right;">COBOL </SPAN> Added COBOL (question mark is omitted, end added). The TITLE attribute can also be used inside any other tag. To describe a link, add it to the <A> tag. An example, from my Pioneers site, with status bar messages thrown in, too.<UL>
There are also a few options when it comes to formatting the text inside the tool tip. The command will insert a carriage return wherever it is placed. creates a linefeed (to my eyes, these two commands to the exact same thing. Correct me if I'm wrong). You can also enter tab spaces by using the 	 command. I also have to mention that there is a 1024 character limit for the tool tips. I think this is generous enough. If you need anything more, you may need to ask yourself if a tool tip is the right thing. Thanks Joe. And another thing - there needs to be no whitespace between the quote sign ending the tip, and the closing >.
When all else fails, combine TITLE and Java ScriptShort Long Medium Long No more messagesHere is the code behind those five examplesIn the <HEAD>And where the items are wanted<STYLE TYPE="text/css"><!-- #tooltip {position: absolute; width: 150px; z-index: 100; visibility: hidden}--> </STYLE> <SCRIPT LANGUAGE="JavaScript"> <!-- var uagent = navigator.userAgent; var appver = navigator.appVersion.substring(0,1); function showTip(ctrl, tiptext) { var tipdiv; if (uagent.indexOf("MSIE") != -1) { if (appver > 3) { // in IE all we need to do is set the "title" attribute ctrl.title = tiptext; } } else { if ((uagent.indexOf("Mozilla") != -1) && (appver > 3)) { tipdiv = document.layers["tooltip"]; // set the tooltip text tipdiv.document.open(); tipdiv.document.write("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2 bordercolor=black><TR><TD BGCOLOR=FFFFCC>"); tipdiv.document.write("<FONT FACE=Verdana, Arial, Helvetica SIZE=-2>"); tipdiv.document.write(tiptext); tipdiv.document.write("</FONT>"); tipdiv.document.write("</TD></TR></TABLE>"); tipdiv.document.close(); // set the tooltip location and show it tipdiv.top = ctrl.y + 20; tipdiv.left = ctrl.x + 10; tipdiv.visibility = "show"; } } } function hideTip() { if ((uagent.indexOf("MSIE") == -1) && (uagent.indexOf("Mozilla") != -1) && (appver > 3)) { // only do this for NN4+ document.layers["tooltip"].visibility = "hidden"; }} // --></SCRIPT> <DIV ID="tooltip"></DIV> <A HREF="#" onMouseOver="showTip(this, 'Short tooltip')" onMouseOut="hideTip()">Short</A> <BR><BR> <A HREF="#" onMouseOver="showTip(this, 'Click here to see more cool tips! \n This is the second line...\n change line with backslash n..\n only works with IE')" onMouseOut="hideTip()">Long</A> <BR><BR> <A HREF="#" onMouseOver="showTip(this, 'The next tooltip uses TITLE instead')" onMouseOut="hideTip()">Medium</A> <BR><BR> <A HREF="#" OnMouseOver="window.status='Tooltips used in TITLE for IE'; return true;" TITLE='Click here to see more cool tips! \n This is the second line... fourth line, after skipping one line'>Long</A> <BR><BR> <A HREF="#" onMouseOver="showTip(this, 'No ')" onMouseOut="hideTip()">No more messages</A>
|
Email CSS begins here |
|
This page is part of Elizabeth Janson's web site
http://www.oocities.org/elizatk/index.html
Tetbury residents in the Eighteenth Century my Australian Family History and Barrie, our Family Poet. |