Esattamente quello che hanno detto, funzionerà.
Nell'elemento padre è possibile impostare un altezza massima.
Sto prendendo sandeep esempio e aggiungendo l'altezza massima e, se necessario, è possibile aggiungere proprietà di larghezza massima. Il testo rimarrà dove dovrebbe stare (se possibile, in alcuni casi sarà necessario modificare alcuni valori per farlo rimanere in là)
span{
background: none repeat scroll 0 0 #F8F8F8;
border: 5px solid #DFDFDF;
color: #717171;
font-size: 13px;
height: 30px;
letter-spacing: 1px;
line-height: 30px;
margin: 0 auto;
position: relative;
text-align: center;
text-transform: uppercase;
top: -80px;
left:-30px;
display:none;
padding:0 20px;
}
span:after{
content:'';
position:absolute;
bottom:-10px;
width:10px;
height:10px;
border-bottom:5px solid #dfdfdf;
border-right:5px solid #dfdfdf;
background:#f8f8f8;
left:50%;
margin-left:-5px;
-moz-transform:rotate(45deg);
-webkit-transform:rotate(45deg);
transform:rotate(45deg);
}
p{
margin:100px;
float:left;
position:relative;
cursor:pointer;
max-height: 10px;
}
p:hover span{
display:block;
}
max-height nel p comma, secondo a ultimo, ultima riga.
Testarlo prima di considerarlo inutile.
fonte
2015-07-19 22:25:36
Forse potresti essere interessato a questa risposta: http://stackoverflow.com/questions/1055581/how-do-i-add-a-tool-tip-to-a-span-element/25836471#25836471 –