:title 쓰면 이미지의 title과 똑같이 나옴
title
<span id="orgnPrjNm"
v-if="prjNm.length <= 25">
{{ prjNm }}
</span>
<span v-else>
<span :title="prjNm" style="cursor: pointer">
{{ prjNm.slice(0, 20) }}...
</span>
</span>
만든 툴팁
<span id="orgnPrjNm"
v-if="prjNm.length <= 25">
{{ prjNm }}
</span>
<span v-else>
<span :data-tooltip="prjNm" style="cursor: pointer">
{{ prjNm?.slice(0, 20) }}...
</span>
</span>
[data-tooltip] {
position: relative;
}
[data-tooltip]:before,
[data-tooltip]:after {
visibility: hidden;
opacity: 0;
position: absolute;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
transition: all 0.2s ease;
font-size: 12px;
letter-spacing: -1px;
margin-top: 55px;
pointer-events: none;
}
[data-tooltip]:before {
height: auto;
width: 400px;
white-space: pre-wrap;
content: attr(data-tooltip);
position: absolute;
left: 50%;
transform: translateX(-50%);
padding: 5px 10px;
border-radius: 5px;
color: #fff;
background: #99abbf;
box-shadow: 0 3px 8px rgba(165, 165, 165, 0.5);
line-height: 1.2;
z-index: 9999;
pointer-events: none;
}
[data-tooltip]:not([data-tooltip=""]):hover:before {
visibility: visible;
opacity: 1;
top: -30px;
pointer-events: none;
}
[data-tooltip]:not([data-tooltip=""]):hover:after {
visibility: visible;
opacity: 1;
top: -8px;
pointer-events: none;
}
'공부기록 > CSS' 카테고리의 다른 글
2월 27일 (1) CSS - transform, transition (0) | 2023.02.27 |
---|---|
2월 24일 CSS - flexbox (0) | 2023.02.24 |
2월 23일 (2) CSS selector 2, z-index, display, flex (0) | 2023.02.23 |
2월 23일 (1) CSS clear, selector1 (0) | 2023.02.23 |
2월 22일 (2) CSS 공간 처리 (0) | 2023.02.22 |