【问题标题】:how to modify tooltip content font size?如何修改工具提示内容的字体大小?
【发布时间】:2017-09-15 16:12:11
【问题描述】:

我觉得tooltip的内容字体很小。 例如,代码如下:

<span name="explanation" data-toggle="tooltip" title="hello world!"></span>

那么如何修改显示的 'hello world!' 的字体大小当鼠标悬停在 span 元素上时?

【问题讨论】:

标签: javascript html css tooltip


【解决方案1】:

首先,在 HTML 头部部分中添加以下代码: 其次,分别使用以下代码在页面上的某处嵌入工具提示

 <style type="text/css">
a.tooltip {
	position: relative;
	text-decoration: none;
	color: blue;
}

a.tooltip span {
	display: none;
}

a.tooltip:hover span {
	position: absolute;
	top: 40px;
        font-size: 40px;
	left: 0px;
	display: block;
	width: 250px;
	color: black;
	background-color: #FFFF40;
	border: 1px solid black;
	padding: 5px;
}
</style>
  &lt;a class="tooltip" href="#"&gt;this text&lt;span&gt;This help text is shown in the tooltip. It spans multiple lines and works in all browsers.&lt;/span&gt;&lt;/a&gt;

【讨论】:

  • 我试过了。这确实是一种聪明的方法。非常感谢~
【解决方案2】:

jQuery Tooltip 是个不错的选择。字体更大,我最喜欢。

【讨论】:

    猜你喜欢
    • 2023-03-21
    • 1970-01-01
    • 2015-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-23
    相关资源
    最近更新 更多