>  기사  >  웹 프론트엔드  >  CSS를 사용하여 상단 툴팁 설정

CSS를 사용하여 상단 툴팁 설정

王林
王林앞으로
2023-09-13 12:01:02876검색

使用 CSS 设置顶部工具提示

상단 툴팁을 설정하려면 bottomCSS 속성을 사용하세요.

다음 코드를 실행하여 상단 툴팁을 텍스트로 설정할 수 있습니다:

Example

Live Demo

<!DOCTYPE html>
<html>
   <style>
      .mytooltip .mytext {
         visibility: hidden;
         width: 140px;
         background-color: blue;
         color: #fff;
         z-index: 1;
         bottom: 100%;
         left: 60%;
         margin-left: -90px;
         text-align: center;
         border-radius: 6px;
         padding: 5px 0;
         position: absolute;
      }
      .mytooltip {
         position: relative;
         display: inline-block;
         margin-top: 50px;
      }
      .mytooltip:hover .mytext {
         visibility: visible;
      }
   </style>
   <body>
      <div class = "mytooltip">Keep mouse cursor over me
         <span class = "mytext"> My Tooltip text</span>
      </div>
   </body>
</html>

위 내용은 CSS를 사용하여 상단 툴팁 설정의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제