툴팁은 추가 정보를 설정하는 데 사용됩니다. 방문자가 요소 위로 마우스 포인터를 이동하면 웹 페이지에서 볼 수 있습니다.
다음은 CSS를 사용하여 툴팁을 작성하는 코드입니다 -
예시
<!DOCTYPE html>
<html>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
}
.toolTip {
position: relative;
display: inline-block;
border-bottom: 3px double rgb(255, 0, 0);
}
.toolTip .toolText {
visibility: hidden;
width: 160px;
background-color: #721cd4;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
top: -35px;
left: -10px;
z-index: 1;
}
.toolTip:hover .toolText {
visibility: visible;
}
</style>
<body>
<h1>Css tooltip example</h1>
<div class="toolTip">
Hover over me
<span class="toolText">Some toolTip text</span>
</div>
<h2>Hover over the above text to see the tooltip</h2>
</body>
</html> 출력
위의 코드는 다음 출력을 생성합니다 -

"Hover over me" 텍스트 위로 마우스를 가져갈 때 -
