mirror of
https://github.com/safing/web
synced 2025-04-18 01:49:08 +00:00
Add tooltip
This commit is contained in:
parent
f8f0e209ec
commit
45b611410a
1 changed files with 83 additions and 0 deletions
|
@ -328,3 +328,86 @@ input:checked {
|
|||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
[tooltip] {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
[tooltip]::before,
|
||||
[tooltip]::after {
|
||||
text-transform: none;
|
||||
font-size: .9em;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
[tooltip]::before {
|
||||
content: '';
|
||||
border: 5px solid transparent;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
[tooltip]::after {
|
||||
content: attr(tooltip);
|
||||
font-family: Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
min-width: 3em;
|
||||
max-width: 21em;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: 1ch 2ch;
|
||||
border-radius: 100px;
|
||||
box-shadow: 0 1em 2em -.5em rgba(0, 0, 0, 0.35);
|
||||
background: #333;
|
||||
color: #fff;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
[tooltip]:hover::before,
|
||||
[tooltip]:hover::after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
[tooltip='']::before,
|
||||
[tooltip='']::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
[tooltip]:not([flow])::before,
|
||||
[tooltip][flow^="up"]::before {
|
||||
bottom: 100%;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #333;
|
||||
}
|
||||
|
||||
[tooltip]:not([flow])::after,
|
||||
[tooltip][flow^="up"]::after {
|
||||
bottom: calc(100% + 5px);
|
||||
}
|
||||
|
||||
[tooltip]:not([flow])::before,
|
||||
[tooltip]:not([flow])::after,
|
||||
[tooltip][flow^="up"]::before,
|
||||
[tooltip][flow^="up"]::after {
|
||||
left: 50%;
|
||||
transform: translate(-50%, -.5em);
|
||||
}
|
||||
|
||||
@keyframes tooltips-vert {
|
||||
to {
|
||||
opacity: .9;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[tooltip]:not([flow]):hover::before,
|
||||
[tooltip]:not([flow]):hover::after,
|
||||
[tooltip][flow^="up"]:hover::before,
|
||||
[tooltip][flow^="up"]:hover::after {
|
||||
animation: tooltips-vert 300ms ease-out forwards;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue