HTML・CSSでつくるツールチップのデザイン5選

HTML・CSSでつくるツールチップのデザインをまとめました。クリックで非表示を切り替えるものや吹き出し風・アニメーション付きのものまで、どれもコピペで再現することが可能です。

テキストから出るツールチップ

テキストから出るツールチップの上向きバージョン

上向き

step1
デザインを調整する
マウスホバーしてください
ツールチップの内容
step2
HTMLをコピペする
HTML
<div class="tooltip-001">
    <div>マウスホバーしてください</div>
    <span>ツールチップの内容</span>
</div>
step3
CSSをコピペする
CSS
.tooltip-001 {
    display: inline-block;
    position: relative;
}

.tooltip-001 > div {
    cursor: pointer;
}

.tooltip-001 > span {
    display: flex;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    padding: .5em 1em;
    border-radius: 3px;
    background-color: #2589d0;
    color: #ffffff;
    font-size: .7em;
    white-space: nowrap;
    transition: opacity .3s;
}

.tooltip-001 > span::before {
    position: absolute;
    top: -6px;
    width: 9px;
    height: 6px;
    background-color: inherit;
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
    content: '';
}

.tooltip-001:hover > span {
    visibility: visible;
    opacity: 1;
}
テキストから出るツールチップの下向きバージョン

下向き

step1
デザインを調整する
マウスホバーしてください
ツールチップの内容
step2
HTMLをコピペする
HTML
<div class="tooltip-002">
    <div>マウスホバーしてください</div>
    <span>ツールチップの内容</span>
</div>
step3
CSSをコピペする
CSS
.tooltip-002 {
    display: inline-block;
    position: relative;
}

.tooltip-002 > div {
    cursor: pointer;
}

.tooltip-002 > span {
    display: flex;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    padding: .5em 1em;
    border-radius: 3px;
    background-color: #2589d0;
    color: #ffffff;
    font-size: .7em;
    white-space: nowrap;
    transition: opacity .3s;
}

.tooltip-002 > span::before {
    position: absolute;
    bottom: -6px;
    width: 9px;
    height: 6px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    content: '';
}

.tooltip-002:hover > span {
    visibility: visible;
    opacity: 1;
}
テキストから出るツールチップの左向きバージョン

左向き

step1
デザインを調整する
マウスホバーしてください
ツールチップの内容
step2
HTMLをコピペする
HTML
<div class="tooltip-003">
    <div>マウスホバーしてください</div>
    <span>ツールチップの内容</span>
</div>
step3
CSSをコピペする
CSS
.tooltip-003 {
    display: inline-block;
    position: relative;
}

.tooltip-003 > div {
    cursor: pointer;
}

.tooltip-003 > span {
    display: flex;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 50%;
    right: -150px;
    transform: translateY(-50%);
    padding: .5em 1em;
    border-radius: 3px;
    background-color: #2589d0;
    color: #fff;
    font-size: .7em;
    white-space: nowrap;
    transition: opacity .3s;
}

.tooltip-003 > span::before {
    position: absolute;
    left: -6px;
    width: 6px;
    height: 9px;
    background-color: inherit;
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    content: '';
}

.tooltip-003:hover > span {
    visibility: visible;
    opacity: 1;
}
テキストから出るツールチップの右向きバージョン

右向き

step1
デザインを調整する
マウスホバーしてください
ツールチップの内容
step2
HTMLをコピペする
HTML
<div class="tooltip-004">
    <div>マウスホバーしてください</div>
    <span>ツールチップの内容</span>
</div>
step3
CSSをコピペする
CSS
.tooltip-004 {
    display: inline-block;
    position: relative;
}

.tooltip-004 > div {
    cursor: pointer;
}

.tooltip-004 > span {
    display: flex;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: -140px;
    transform: translateY(-50%);
    padding: .5em 1em;
    border-radius: 3px;
    background-color: #2589d0;
    color: #fff;
    font-size: .7em;
    white-space: nowrap;
    transition: opacity .3s;
}

.tooltip-004 > span::before {
    position: absolute;
    right: -6px;
    width: 6px;
    height: 9px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    content: '';
}

.tooltip-004:hover > span {
    visibility: visible;
    opacity: 1;
}

アイコンから出るツールチップ

アイコンから出るツールチップのクエスチョンマークバージョン

クエスチョンマーク

step1
デザインを調整する
  • アイコンの塗りつぶし

ツールチップの内容

step2
HTMLをコピペする
HTML
<div class="tooltip-005">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
        <path d="M12 0C8.3 0 5.9 1.5 4 4.3c-.4.5-.3 1.1.2 1.5l2 1.5c.5.4 1.2.3 1.6-.2 1.2-1.5 2-2.3 3.9-2.3 1.4 0 3.2.9 3.2 2.3 0 1.1-.9 1.6-2.3 2.4-1.7.9-3.9 2.1-3.9 5v.5c0 .6.5 1.1 1.1 1.1h3.4c.6 0 1.1-.5 1.1-1.1v-.3c0-2 5.9-2.1 5.9-7.5C20.2 3.1 16 0 12 0zm-.4 17.5c-1.8 0-3.2 1.5-3.2 3.2 0 1.8 1.5 3.2 3.2 3.2s3.2-1.5 3.2-3.2-1.5-3.2-3.2-3.2z"
              fill="#c6cdd3"/>
    </svg>
    <p>ツールチップの内容</p>
</div>
step3
CSSをコピペする
CSS
.tooltip-005 {
    display: inline-block;
    position: relative;
}

.tooltip-005 svg {
    width: 20px;
    height: 20px;
    padding: 3px;
    border: 2px solid #c6cdd3;
    border-radius: 50%;
    box-sizing: border-box;
    cursor: pointer;
}

.tooltip-005 p {
    display: flex;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: -43px;
    left: 50%;
    transform: translateX(-50%);
    padding: .5em 1em;
    border-radius: 3px;
    background-color: #00000099;
    color: #fff;
    font-size: .7em;
    white-space: nowrap;
    transition: opacity .3s;
}

.tooltip-005:hover > p {
    visibility: visible;
    opacity: 1;
}

.tooltip-005 p::before {
    position: absolute;
    top: -6px;
    width: 9px;
    height: 6px;
    background-color: inherit;
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
    content: '';
}