Подсказка с треугольником
Я создал jsFiddle для этого вопроса.
a.tip {
position: relative;
}
a.tip span {
display: none;
position: absolute;
top: -5px;
left: 60px;
width: 125px;
padding: 5px;
z-index: 100;
background: #000;
color: #fff;
-moz-border-radius: 5px; /* this works only in camino/firefox */
-webkit-border-radius: 5px; /* this is just for Safari */
}
a:hover.tip {
font-size: 99%; /* this is just for IE */
}
a:hover.tip span {
display: block;
}
<center><a href="#" onclick="location.href='http://google.com/'; return false;" class="tip">Link!<span>Hi its me!</span></a></center>
Ответы
Ответ 1
Вы можете сделать это с помощью CSS, используя трюк треугольника css
a.tip span:before{
content:'';
display:block;
width:0;
height:0;
position:absolute;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right:8px solid black;
left:-8px;
top:7px;
}
Демо на http://jsfiddle.net/dAutM/7/
живой фрагмент
a.tip {
position: relative;
}
a.tip span {
display: none;
position: absolute;
top: -5px;
left: 60px;
width: 125px;
padding: 5px;
z-index: 100;
background: #000;
color: #fff;
-moz-border-radius: 5px;
/* this works only in camino/firefox */
-webkit-border-radius: 5px;
/* this is just for Safari */
}
a.tip span:before {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid black;
left: -8px;
top: 7px;
}
a:hover.tip {
font-size: 99%;
/* this is just for IE */
}
a:hover.tip span {
display: block;
}
<center><a href="http://google.com/" class="tip">Link!<span>Hi its me!</span></a></center>
Ответ 2
Я разработал CSStooltip.com, чтобы всплывающие подсказки с треугольником только в CSS.
Пример:
![enter image description here]()
span.tooltip:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-width: 10px;
border-style: solid;
border-color: transparent #FFFFFF transparent transparent;
top: 11px;
left: -24px;
}
Ответ 3
Попробуйте следующее: http://ecoconsulting.co.uk/examples/css-tooltip/
Он объясняет проблемы и устраняет проблемы, а также позволяет стрелку и всплывающую подсказку с рамкой.
Ответ 4
Вы можете поместить как цвет, так и изображение в качестве фона, а также установить его положение.
В приведенном ниже коде замените изображение в теге url
тем, у кого есть треугольник.
a.tip span {
display: none;
position: absolute;
top: -5px;
left: 60px;
width: 125px;
padding: 5px;
z-index: 100;
background: #000 url("http://www.triangle-fr.com/img/tooltip.png");
color: #fff;
-moz-border-radius: 5px; /* this works only in camino/firefox */
-webkit-border-radius: 5px; /* this is just for Safari */
}
см. здесь http://www.w3schools.com/cssref/pr_background-position.asp