microtip Tooltip工具提示样式

最近开发项目,想增加滑动提示文字,类似img alt和i的title,但是效果都不是很理想,当然jq也有,但是用起来比较繁琐,使用不是特别方便

于是在github上看到了一个不错的库:

https://github.com/sevck/microtip

国外写的一个纯css3的tooltips

 

安装使用很简单:

Installation

via npm

npm install microtip

via yarn

yarn add microtip

via CDN

https://unpkg.com/microtip/microtip.css

direct download

curl -o microtip https://github.com/ghosh/microtip/blob/master/microtip.css

Setup

in PostCSS

@import 'microtip';

in Webpack

import microtip from 'microtip/microtip.css'

in SCSS

@import 'microtip/microtip';

Usage

   import:
<link rel="stylesheet" type="text/css" href="css/microtip.css">
<button aria-label="Hey tooltip!" data-microtip-position="up" role="tooltip">

也支持调整显示的位置,滑动出现的时间、字体大小等等

Customization

Microtip uses css variables, which allows you to customize the behavior of the tooltip as per your needs.

VariableDescriptionDefault Value
--microtip-transition-durationSpecifies the duration of the tootltip transition.18s
--microtip-transition-delayThe delay on hover before showing the tooltip0s
--microtip-transition-easingThe easing applied while transitioning the tooltipease-in-out
--microtip-font-sizeSets the font size of the text in tooltip13px
--microtip-font-weightThe font weight of the text in tooltipnormal
--microtip-text-transformControls the casing of the textnone

 

效果:

鼠标移动文字提示,或者重写覆盖样式都是可以的

 

转载于:https://www.cnblogs.com/sevck/p/9758807.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值