tooltip
last update:
2024/11/15
<style>
h1 {
margin: 0;
padding: 0;
font-size: 0.8125rem;
line-height: 1;
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
min-height: 1.125rem;
margin-top: 1.25rem;
}
.title__inner {
display: flex;
align-items: center;
}
.title__label {
font-size: 0.875rem;
font-weight: 700;
}
.help {
display: inline-flex;
position: relative;
margin-left: 0.1875rem;
}
.help__budge {
display: flex;
justify-content: center;
align-items: center;
width: 1.125rem;
height: 1.125rem;
font-size: 0.75rem;
color: rgb(200, 200, 200);
border: rgb(200, 200, 200) 0.0625rem solid;
border-radius: 9999px;
}
.help__tooltip {
display: none;
position: absolute;
z-index: 10;
top: 0.625rem;
left: 1.4375rem;
transform: translateY(-50%);
width: max-content;
animation-timeline: auto;
animation-range-start: normal;
animation-range-end: normal;
animation: 0.3s ease 0s 1 normal none running fadeIn;
}
.help:hover .help__tooltip {
display: block;
}
.help__tooltipInner {
display: flex;
align-items: center;
}
.help__tooltipTriangle {
display: block;
clip-path: polygon(0px 50%, 100% 0px, 100% 100%);
width: 0.375rem;
height: 0.5rem;
background: rgba(0, 0, 0, 0.75);
}
.help__tooltipText {
max-width: 25rem;
color: rgb(255, 255, 255);
font-size: 0.6875rem;
font-weight: 300;
line-height: calc(1.6);
padding: 0.4375rem 0.625rem;
border-radius: 0.1875rem;
background: rgba(0, 0, 0, 0.75);
}
</style>
<div class="title">
<div class="title__inner">
<h1><label class="title__label">aaaaa</label></h1>
<div class="help">
<span class="help__budge">?</span>
<div class="help__tooltip">
<div class="help__tooltipInner">
<span class="help__tooltipTriangle"></span>
<p class="help__tooltipText">あああああああああああああああああああああああああああああああああああああああああああああああああああ</p>
</div>
</div>
</div>
</div>
</div>
<div>
<input id="aaaaaa" name="aaaaaa" placeholder="placeholder" value="">
</div>