Skip to content

Commit 6700556

Browse files
committed
Add abilty to customize font sizes
1 parent 62cc219 commit 6700556

File tree

5 files changed

+1490
-7
lines changed

5 files changed

+1490
-7
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
# Microtip.css
1+
<p align="center">
2+
<img src="https://www.dropbox.com/s/kcn0kccs5bpxhz0/microtip.svg?raw=1" width="180px">
3+
</p>
4+
5+
<p align="center">
6+
<a href="#">
7+
<img src="https://img.shields.io/badge/made%20with-love-E760A4.svg" alt="Made with love">
8+
</a>
9+
<a href="https://opensource.org/licenses/MIT" target="_blank">
10+
<img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License">
11+
</a>
12+
<a href="https://api.travis-ci.org/ghosh/uiGradients" target="_blank">
13+
<img src="https://api.travis-ci.org/ghosh/microtip.svg" alt="Build Status">
14+
</a>
15+
</p>
216

17+
<p align="center">
318
A modern, ultra lightweight css tooptip library. Just `1kb` minified and gzipped.
19+
</p>
20+
21+
---
22+
23+
24+
![Microtip](https://www.dropbox.com/s/gracjkb2rca2zj6/microtip.gif?raw=1)
425

526
&nbsp;
627
## Table of Contents
@@ -80,22 +101,30 @@ By default, the tooltip will takeup only the size it requires to show the text.
80101

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

104+
83105
| Variable | Description | Default Value |
84106
|----------------------------------|----------------------------------------------------|---------------|
85107
| `--microtip-transition-duration` | Specifies the duration of the tootltip transition | `.18s` |
86108
| `--microtip-transition-delay` | The delay on hover before showing the tooltip | `0s` |
87109
| `--microtip-transition-easing` | The easing applied while transitioning the tooltip | `ease-in-out` |
110+
| `--microtip-font-size` | Sets the font size of the text in tooltip | `13px` |
111+
| `--microtip-font-weight` | The font weight of the text in tooltip | `normal` |
112+
| `--microtip-text-transform` | Controls the casing of the text | `none` |
113+
88114

89115
Example:-
90116
```css
91117
:root {
92118
--microtip-transition-duration: 0.5s;
93119
--microtip-transition-delay: 1s;
94120
--microtip-transition-easing: ease-out;
121+
--microtip-font-size: 13px;
122+
--microtip-font-weight: bold;
123+
--microtip-text-transform: uppercase;
95124
}
96125
```
97126

98-
The above code will transition the tooltip over `0.5s` while applying an easing of type `ease-out` after a delay of `1s`
127+
The above code will transition the tooltip over `0.5s` while applying an easing of type `ease-out` after a delay of `1s`. The text will be `bold` and `uppercase` and have a font size of `13px`.
99128

100129
&nbsp;
101130

microtip.css

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
/*
44
* microtip.css
5+
*
6+
* Modern lightweight css tooltips
7+
* Less than 1kb
8+
*
59
* Licensed under the MIT license
610
* Copyright (c) 2017 Indrashish Ghosh
711
*/
@@ -35,7 +39,9 @@
3539
border-radius: 4px;
3640
color: #ffffff;
3741
content: attr(data-microtip);
38-
font-size: 12px;
42+
font-size: var(--microtip-font-size, 13px);
43+
font-weight: var(--microtip-font-weight, normal);
44+
text-transform: var(--microtip-text-transform, none);
3945
padding: .5em 1em;
4046
white-space: nowrap;
4147
box-sizing: content-box;
@@ -71,9 +77,10 @@
7177
transform: translate3d(-50%, -5px, 0);
7278
}
7379

74-
[data-microtip-position="top"]:after {
80+
[data-microtip-position|="top"]:after {
7581
transform: translate3d(-50%, 0, 0);
7682
bottom: 100%;
83+
left: 50%;
7784
}
7885

7986
[data-microtip-position="top"]:hover:after {
@@ -121,9 +128,10 @@
121128
transform: translate3d(-50%, 0, 0);
122129
}
123130

124-
[data-microtip-position="bottom"]:after {
131+
[data-microtip-position|="bottom"]:after {
125132
transform: translate3d(-50%, -10px, 0);
126133
top: 100%;
134+
left: 50%;
127135
}
128136

129137
[data-microtip-position="bottom"]:hover:after {

microtip.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "microtip",
3-
"version": "0.0.4",
3+
"version": "0.1.4",
44
"description": "A modern, ultra light css tooltip library. Just 1kb minified and gzipped",
55
"style": "microtip.css",
66
"keywords": [

0 commit comments

Comments
 (0)