Jump to content
  • Announcements

    • boen_robot

      Guidelines and Netiquette   03/28/2017

      Posting Problems:   Having problems posting your topic? Read through this: To join, you agree to our terms and conditions and fill out and submit a registration form. An activation email will be sent to your email adress, so you'll need to verify your account. After that the account has to be validated by one of the moderators. This will mean that it can take up to a day to be activated. A couple of things to remember to ensure approval: Don't use an email address in one of those $2 four character .com domains eg. xyds.com. These will be deleted and the domain added to the banned list. Don't use an email address that is within a domain with a bad reputation for spam. A Google search is run on every email address and email domain. Don't sign up with an email address that doesn't exist, doesn't work or requires the sender to answer a quiz before their email can get to you. Put your country and or state and city in the signup form. Blank forms will go to the botton of the "to do" list. And make sure that your email address and your country match, saying you're from Alabama and using a .ru email address is not going to get you activated. After a membership is activated the first few posts will be monitored. Posting spam or unapproved topics described in the agreement results in an immediate ban. The email provider and the IP addresses associated with the account will be banned and all posts will be deleted. These strict measures have been deemed necessary to hinder spam. Sorry for any inconvenience this causes, but it's not liable to change. If, after reading this, you still can't post and don't understand why, contact one of the Moderators listed here.   Topic Guidelines   Including the following information can expedite an accurate response from board members: Must be a Specific Problem or Question related to web design and development Include Code in Question (wrap with   for small blocks of code and for longer blocks   ) Include Code Author Include Extra Notes/Modifications/Attempts Include web link to page/file when possible Content Guidelines   You may not post, upload, link to, or email any Content that contains, promotes, gives instruction about, or provides prohibited Content. Prohibited Content includes any Content that breaks any local, state, county, national or international law. Prohibited Content also includes: No direct or indirect advertising or websites, forums, products, services No hijacking of posts (do not post your question in someone elses) Content that infringes upon any rights [ex. MP3s and ROMs] (including, but not limited to, copyrights and trademarks) Abusive, threatening, defamatory, racist, or obscene Viruses or any other harmful computer software False Information or libel Spam, chain letters, or Pyramid schemes Gambling or Illicit drugs Terrorism Hacking or cheating for internet/online games Warez, Roms, CD-Keys, Cracks, Passwords, or Serial Numbers Pornography, nudity, or sexual material of any kind Excessive profanity Invasive of privacy or impersonation of any person/entity Hacking materials or information Posting Tips   There are more BBcodes than there are buttons for on the reply menu. To get the full list, click "BB Code Help" underneath the clickable smilie face menu. Use   for small snippets of code Use   for lengthy snippets of code Use   if your snippet is HTML (optional) Use   if your snippet is SQL (optional) Rules of Conduct   Be nice. There's no need for calling someone stupid if they ask an 'easy' question. Keep your avatars and signatures absolutely child friendly. We have a younger audience on this forum. Keep your language appropriate for the same reason above. Do not PM moderators for help on the forum. Post on the topic, or create a new one.   Spam:   Recently, as you have all without doubt noticed, we have had lots of spam and advertisement on the forum. Therefore, we'd like to alert you as to what to do when you have found any of the aforementioned annoying messages: it. Immediately. Give a clear reason, please, if the advertising is not evident. DO NOT POST! Report, let the post stay as is, and we will get to it, meanwhile if you continue to post as normal in the other threads, it won't be on the top so long. Refrain from PMing the member. This won't help at all, as they are most likely spambots anyway. Thank you.       Images in signatures:   After thinking of users on dial-up, we have decided to enforce the following rules regarding signatures. Please pay heed to them. Respecting these rules is respecting the members on this forum with dial-up. Signature rules: No animated images AT ALL. No matter the amount of animation. Maximum image widthxheight: 300x150 Maximum image (file) size: 15kb Use calm colors. Do not use highly contrasting images in your signature, as this can get really annoying when seeing several posts from one member in the same thread. The same prohibited content goes for images as for posts. Lastly, use common sense. No lengthy signatures please. Save us some scrolling. Thank you.       Links in signatures:   Please understand that w3schools.com only exists because of voluntary work and is barely supported by the advertising littered throughout the tutorials and the forum. So, please, stop advertising other sites. DO not post links that drive traffic away from the w3schools domain - especially to a site that offers similar if not identical information. Please help support the site by keeping individuals on it. Thank you. Here are some guidelines as to what you can put in your signature: w3schools links --> allowed w3.org links --> allowed browser links --> allowed html editor links --> allowed personal sites --> allowed tutorial sites competing with w3schools --> NOT allowed sites completely irrelevant to webprogramming and this forum --> NOT allowed   Thanks for understanding, and for taking the time to read this. ~W3Schools Modstaff~
Sign in to follow this  
ShadowMage

Multiline Title

Recommended Posts

ShadowMage    94

Hey guys, quick question here. Anyone know how to make a multi-line title on an element? What I mean is this:<input type='button' id='aBtn' value='AButton' title='This is a& #013;multi-line title' />The above works in IE, but FF won't create the new line. I also tried the line feed (& #10; ) entity but that didn't work either. Anybody know how to do this?Thanks.

Edited by jkloth

Share this post


Link to post
Share on other sites
thescientist    231

if you force a size on the element, will the text wrap down?

Share this post


Link to post
Share on other sites
ShadowMage    94
if you force a size on the element, will the text wrap down?
This is on the title attribute of the tag. I just noticed that I forgot to put a space in the entity tags so I edited my post to show the entities I'm using.

Share this post


Link to post
Share on other sites
thescientist    231
This is on the title attribute of the tag. I just noticed that I forgot to put a space in the entity tags so I edited my post to show the entities I'm using.
ah ha, I getcha, another case of me reading too fast. You making tooltips?

Share this post


Link to post
Share on other sites
ShadowMage    94
ah ha, I getcha, another case of me reading too fast. You making tooltips?
Yea. I want to avoid using JS if I can. It's not a big deal if I have to though.

Share this post


Link to post
Share on other sites
thescientist    231

Hmm, I've definitely done multi-line tooltips, but that wasn't using the title property though.

Share this post


Link to post
Share on other sites
ShadowMage    94
Hmm, I've definitely done multi-line tooltips, but that wasn't using the title property though.
So, JavaScript is my only option then, eh?

Share this post


Link to post
Share on other sites
thescientist    231

well, the way I learned to do it was with CSS; :hover and span. Could that work for you? Hover should be able to work on any element.

Share this post


Link to post
Share on other sites
ShadowMage    94
well, the way I learned to do it was with CSS; :hover and span. Could that work for you? Hover should be able to work on any element.
I was thinking about using :hover but I can't seem to wrap my mind around how it's going to work. Will the tooltip be positioned by the element I'm hovering on?I was kinda thinking the CSS might look like this:
.hoverItem span {   position: absolute;   visibility: hidden;}.hoverItem:hover span {   visibility: visible;}

Except I'm not sure how to position the span in relation to the item I'm hovering on as it will change. The data is generated with a loop in PHP so there will be multiple .hoverItem elements.

Share this post


Link to post
Share on other sites
thescientist    231

On my (old, and unfortunately current - redesign in progress as we speak!) site, analogstudios.net, you'll see I'm using it for the calendar. Please ignore the many bad practices that litter my site... :) HTML

<td bgcolor="#FFFF00"><center><a href="shows.php" class="tooltip">21<span>Dave Flamand - Acoustic @ The Albion </span></a></center></td>

CSS

a.tooltip{  position: relative;}a.tooltip span{  display: none;}a.tooltip:hover span{  display: block;  position: absolute;  top: 1em;  left: 2em;  padding: 0.2em 0.6em;  border: 1px solid #996633;  background-color: #FFFF66;  color: #000000;}

Basically the span is hidden, until hovered. With relative and absolute positioning, we keep the span near the element that we're hovering over, simulating the effect one would get from the title attribute.and, of course, give due credit, I got it out of this book from Andy Budd, who I see since looking this up just now has second edition of this book! :) cool man, hope that helps.

Edited by thescientist

Share this post


Link to post
Share on other sites
ShadowMage    94

Yes, it does! I forgot about the relative positioning bit. :)Thanks!

Share this post


Link to post
Share on other sites
boen_robot    105

For future reference's sake, google it...

Share this post


Link to post
Share on other sites
ShadowMage    94
For future reference's sake, google it...
If I always knew what I was googling, I would. But alot of the time, I would call something one thing when in fact it's called something else and then I'd be sifting through all kinds of useless links.But, I do see your point. I'll try to remember that for next time. :)

Share this post


Link to post
Share on other sites
ShadowMage    94

OK, I successfully used this technique on the project I was working on when I started this thread. Now I tried to use it on a different project and it partially works. My tooltips show up when I hover on the menu items, but they are constrained by the width of my menu. :) What I mean is, the text in my tooltips wraps to a new line when it reaches the edge of the menu instead of extending beyond it. No matter how I position the tooltips, they always wrap at the edge of my menu.Here's an attempt to illustrate the problem.

#content {	background-color: #E5E5E5;	padding-top: 3px;	overflow: auto;}#menu {	width: 175px;	float: left;}#menu li {	background-color: #DDDDDD;	background: -moz-radial-gradient(center, #A9A9A9, #DBDBDB 80%);	-moz-border-radius: 3px;	border: 1px solid #CCCCCC;	margin-bottom: 1px;}#menu li:hover {	background-color: #CFCFCF;	background: -moz-radial-gradient(center, #E7E7E7, #ADADAD 80%);}.tipContainer {	position: relative;}.tooltip {	position: absolute;	top: -20px;	left: 0px;	visibility: hidden;	background-color: #303099;	background: -moz-radial-gradient(center, #9090FD, transparent 95%);	color: #F3F322;	z-index: 10;}.tipContainer:hover .tooltip {	visibility: visible;}

And the HTML:

<div id='content'><ul id='menu'>	<li class='tipContainer'>New Animal<span class='tooltip'>Add a new animal to the herd</span></li>	<li class='tipContainer'>Breeding<span class='tooltip'>Add a new breeding record</span></li>	<li class='tipContainer'>Freshening<span class='tooltip'>Add a new freshening record</span></li>	<li class='tipContainer'>Treatment<span class='tooltip'>Add a new treatment record</span></li>	<li class='tipContainer'>Toggle View<span class='tooltip'>Toggle between detail view and datasheet view</span></li></ul></div>

Share this post


Link to post
Share on other sites
ShadowMage    94

Well, I fixed it by adding white-space: nowrap to the tooltip class. But....why do I have to have the nowrap specified? I thought absolute position was supposed to remove it from the flow, meaning it would no longer be constrained by its parent's dimensions?

Share this post


Link to post
Share on other sites

If the parents position is relative, then positioning a child element with absolute will only make it absolute compared to its parent element, not the entire page. Other things may happen with other combinations.:)

Share this post


Link to post
Share on other sites
ShadowMage    94
If the parents position is relative, then positioning a child element with absolute will only make it absolute compared to its parent element, not the entire page. Other things may happen with other combinations.
Ah, right. Didn't think of that. :) Thanks.

Share this post


Link to post
Share on other sites
ShadowMage    94

Ok here's another question. How do I get the tooltip to show up in front of my header? I can't seem to get it to come forward. I've tried setting position: relative and z-index of the .tipContainer class, the #menu, and the #bodyWrap and none of them seem to work. The first tooltip ('New Animal' button) is cut off by the #tabNav menu above it.HTML:

<div id='wrapper'><div id='header'>	<img src='images/cow.png' alt='Logo' />	<h1>Herd Management</h1>	<h3>Dairy Herd Database Management System</h3>	<ul id='tabNav'>		<li>Home</li>		<li>Reproduction</li>		<li>Health</li>		<li>Production</li>		<li class='floatRight'>Youngstock</li>	</ul></div> <!-- End header div --><div id='bodyWrap'><ul id='menu'>	<li class='tipContainer'>New Animal<span class='tooltip'>Add a new animal to the herd</span></li>	<li class='tipContainer'>Breeding<span class='tooltip'>Add a new breeding record</span></li>	<li class='tipContainer'>Freshening<span class='tooltip'>Add a new freshening record</span></li>	<li class='tipContainer'>Treatment<span class='tooltip'>Add a new treatment record</span></li>	<li class='tipContainer'>Toggle View<span class='tooltip'>Toggle between detail view and datasheet view</span></li></ul></div> <!-- End bodyWrap div --></div> <!-- End wrapper div -->

CSS:

div#wrapper {	width: 900px;	margin: 0px auto;	padding: 4px;}#header {	background-color: #CDCDCD;	overflow: auto;}#header img {	float: left;	margin: 0px 4px;}#header h1 {	font-size: 38pt;	color: #303088;}#header h3 {	font-size: 24pt;	color: #202088;}ul {	list-style: none;	padding: 2px 3px;}ul li {	text-align: center;}ul li:hover {	cursor: pointer;}#tabNav {	background-color: #202088;	color: #F3F322;	clear: both;	overflow: auto;}#tabNav li {	float: left;	width: 135px;	background: -moz-radial-gradient(center, #3030ED, #202088 85%);}#tabNav li.floatRight {	float: right;}#tabNav li:hover {	background-color: #F3F322;	background: -moz-radial-gradient(center, #F9F922, #B3B311 80%);	-moz-border-radius: 3px;	color: #202088;}#bodyWrap {	background-color: #E5E5E5;	padding: 3px;	overflow: auto;}#menu {	width: 125px;	float: left;}#menu li {	background-color: #DDDDDD;	background: -moz-radial-gradient(center, #A9A9A9, #DBDBDB 80%);	-moz-border-radius: 3px;	border: 1px solid #CCCCCC;	margin-bottom: 1px;}#menu li:hover {	background-color: #CFCFCF;	background: -moz-radial-gradient(center, #E7E7E7, #ADADAD 80%);}.tipContainer {	position: relative;}.tooltip {	position: absolute;	top: -22px;	left: 95px;	visibility: hidden;	background-color: #303099;	background: -moz-radial-gradient(center, #9090FD, transparent 65%);	color: #F3F322;	z-index: 10;	white-space: nowrap;	padding: 12px 85px;}.tipContainer:hover .tooltip {	visibility: visible;}

I don't really know what else to try. I thought the z-index is supposed to bring it out in front if it's a higher number. I tried resetting all elements to z-index: 0 too and that didn't work. Maybe it's because my menu is floating?

Share this post


Link to post
Share on other sites
ShadowMage    94

Nobody? Surely someone must know...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×