2013-03-28 43 views
0

我想在IE8上设置浏览器给出的默认工具提示,最好只能从CSS获得,所以我该怎么做。我已经阅读了很多文章,直到现在我什么都没有。在IE8上自定义工具提示标题

所以我的HTML看起来像:

<a href="#" title="Show this title on IE8" class="title">hover me to see the tooltip</a> 

小提琴:http://jsfiddle.net/uGudk/36/

所以我如何才能在IE8的工作作风此提示。

+0

与此类似:[如何在html中设置alt tooltip?](http://stackoverflow.com/questions/5041589/how-to-style-the-alt-tooltip-in-html) –

+1

你可以使用jQuery工具提示:http://jqueryui.com/tooltip/ – gaynorvader

+0

@Christofer Eliasson no不是! – mcmwhfy

回答

1

您不能设计TITLE工具提示,它不是HTML元素。

+0

我不明白。为什么有人会对这个答案给出一个减号。如果没有发布,我会告诉你同样的事情。 –

+0

因为他们不知道基于Javascript的工具提示和触发内置浏览器行为的TITLE属性之间的区别。 –

+0

@Diodeus 检查此:http://jsfiddle.net/tDQWN/但不能在IE8上工作 – mcmwhfy

1

你可以试试这个: <a class="tooltip" href="#">Click<span>This is a tooltip</span></a>

<style type="text/css"> 
.tooltip { 
    border-bottom: 1px dotted #000000; 
    color: #000000; 
    outline: none; 
    cursor: help; 
    text-decoration: none; 
    position: relative; 
} 
.tooltip:hover span { 
    font-family: Calibri, Tahoma, Geneva, sans-serif; 
    position: absolute; 
    left: 1em; 
    top: 2em; 
    z-index: 99; 
    margin-left: 0; 
    width: 250px; 
    display: block; 
} 
span{ 
    display: none;  
} 
</style> 

Source

jsFiddle

+0

哎呀..我们在那里见过:) –

+0

@Baadshah我认为我们做到了;) – 9edge

+0

哈哈哈..它发生:)。 –

1
.tooltip { 
    border-bottom: 1px dotted #000000; color: #000000; outline: none; 
    cursor: help; text-decoration: none; 
    position: relative; 
      } 


.tooltip:hover span { 
      border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; 
      box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); 
      font-family: Calibri, Tahoma, Geneva, sans-serif; 
      position: absolute; left: 1em; top: 2em; z-index: 99; 
      margin-left: 0; width: 250px; 
     } 

Working DEMO

+0

我不能添加一个类或其他跨度,我只想样式标题像[标题] – mcmwhfy

+0

不,我们不能像TITLE那样风格。 –

+0

检查此:jsfiddle.net/tDQWN但不能在IE8上工作 – mcmwhfy

1

你的一些评论中列出的小提琴DOES BAS在IE8中工作。但是,大多数实际样式是IE8无法识别的样式(在IE8中,box-shadow,linear-gradientborder-radius都不受支持)。如果您使用IE8识别的样式(如background-color或使用background-image的实际图像),那么它也将在IE8中进行样式设置。

这里有一个background-color一个例子,所以你可以看到它在IE8:http://jsfiddle.net/elezar/w8bBk/

而且,你做在什么例子技术上并不造型称号。它基本上与@sureh和@ 9edge建议的做同样的事情,但是你通过CSS而不是HTML本身添加额外的元素。除了您添加的样式和样式外,您实际上仍会看到标题工具提示。