<main class="main-wrapper">
<button type="menu" class="tooltip mt48 ml40" title="カーソルを当てるとツールチップ表示" role="tooltip" aria-label="カーソルを当てるとツールチップ表示">
ツールチップ<br>
カーソルを当ててね
</button>
</main>
<main class="main-wrapper">
<button type="menu" class="tooltip mt48 ml40" title="カーソルを当てるとツールチップ表示" role="tooltip" aria-label="カーソルを当てるとツールチップ表示">
ツールチップ<br>
カーソルを当ててね
</button>
</main>
/* No context defined. */
.tooltip {
display: block;
position: relative;
width: auto;
height: auto;
margin: 5rem auto auto;
padding: 1rem;
border: 1px solid #333;
text-decoration: none;
border-radius: 5px;
transition: transform var(--ease-out-cubic) .3s;
}
.tooltip::before {
content: "";
width: 0;
height: 0;
border: 1px solid #333;
border-style: solid;
border-width: .375rem;
}
.tooltip::after {
content: attr(aria-label);
height: 1.5625rem;
padding: 0 .625rem;
border: 1px solid #333;
background: #333;
text-align: center;
line-height: 3rem;
font-family: var(--base-font);
font-size: .9rem;
white-space: nowrap;
color: var(--white);
border-radius: .5rem;
}
.tooltip::before, .tooltip::after {
position: absolute;
bottom: 93%;
left: -2000px;
z-index: 6;
height: 3rem;
margin-bottom: 1.5rem;
opacity: 0;
transition: opacity .5s ease-in-out, bottom .5s ease-in-out;
}
.tooltip::before {
top: -1.5rem;
width: 0;
height: 0;
margin-bottom: .0625rem;
border-top: 17px #333 solid;
border-right: 10px transparent solid;
border-bottom: 0 transparent solid;
border-left: 10px transparent solid;
border-style: solid;
}
.tooltip:hover::before, .tooltip:focus::before {
transition: opacity .3s;
}
.tooltip:hover::after, .tooltip:focus::after {
transition: opacity .15s ease-out;
}
.tooltip:hover::before, .tooltip:focus::before, .tooltip:hover::after, .tooltip:focus::after {
left: 50%;
opacity: 1;
transform: translateX(-50%);
}
.tooltip > .icon {
font-size: calc(var(--font-size-l4));
}
No notes defined.