文本/链接

Balloon - 纯CSS3简单实用tooltips工具提示

阿里云


balloon.css 是一款实用纯 CSS3 制作的简单实用的 tooltips 工具提示效果库。该 tooltips 通过简单的设置可以实现在不同位置显示提示框,根据内容的多少来自动设置提示框的大小,它还可以显示 unicode 编码和 Font Awesome 字体图标等。

使用方法

实用该工具提示效果需要在页面中引入 balloon.css 或 balloon.min.css 文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" href="css/balloon.css">

tooltips 的位置

可以通过 data-balloon-pos 属性的设置来实现不同 tooltips 的位置的定位。可选值有:up, down, left 或 right。

  1. <button data-balloon="Whats up!" data-balloon-pos="up">Hover me!</button>
  2. <button data-balloon="Whats up!" data-balloon-pos="left">Hover me!</button>
  3. <button data-balloon="Whats up!" data-balloon-pos="right">Hover me!</button>
  4. <button data-balloon="Whats up!" data-balloon-pos="down">Hover me!</button>

tooltips 的长度

默认情况下,tooltips 总是会显示在一行中,你可以通过 data-balloon-length 属性来修改默认的行为。可选值有:small, medium, large 或 fit。

  1. <button data-balloon-length="small" data-balloon="Hi." data-balloon-pos="up">Hover me!</button>
  2.  
  3. <button data-balloon-length="medium"
  4.       data-balloon="Now that's a super big text we have over here right? Lorem ipsum dolor sit I'm done."
  5.       data-balloon-pos="up">
  6.   I'm a medium tooltip.
  7. </button>
  8.  
  9. <button data-balloon-length="large"
  10.       data-balloon="What about something really big? This may surpass your window dimensions. Imagine you're on that boring class with that boring teacher and you didn't slept so well last night. Suddenly you're sleeping in class. Can you believe it?!"
  11.       data-balloon-pos="up">
  12.   I'm a large tooltip
  13. </button>
  14.  
  15. <button data-balloon-length="xlarge"
  16.       data-balloon="What about something really big? This may surpass your window dimensions. Imagine you're on that boring class with that boring teacher and you didn't slept so well last night. Suddenly you're sleeping in class. Can you believe it?!"
  17.       data-balloon-pos="up">
  18.   I'm a Xlarge tooltip
  19. </button>
  20.  
  21. <button data-balloon-length="fit"
  22.       data-balloon="What about something really big? This may surpass your window dimensions. Imagine you're on that boring class with that boring teacher and you didn't slept so well last night. Suddenly you're sleeping in class. Can you believe it?!"
  23.       data-balloon-pos="up">
  24.   My width fill fit to element
  25. </button>

使用字体图标

你可以在 tooltips 中添加任何的 HTML 字符或第三方的字体图标。

  1. <button data-balloon="HTML special characters: ☻ &#x2702; ♜"
  2.                  data-balloon-pos="up">Hover me!</button>

也可以添加 Font Awesome 字体图标。

  1. <button class="fa"
  2.       data-balloon="Font Awesome:     "
  3.       data-balloon-pos="up">Hover me!</button>

Github 地址:https://github.com/kazzkiq/balloon.css

Balloon - 纯 CSS3 简单实用 tooltips 工具提示

已有 418 人购买
查看演示升级 VIP立刻购买

演示地址
收藏
(1)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!