Tooltip with HTML content without JavaScript

前端 未结 8 896
借酒劲吻你
借酒劲吻你 2020-11-30 00:24

There are plenty of JavaScript-based libraries that show tooltips when you hover your mouse over a certain area of a web page. Some are rather plain, some allow the tooltip

8条回答
  •  死守一世寂寞
    2020-11-30 00:54

    This one is very interesting,

    HTML and CSS only

    .help-tip {
      position: absolute;
      top: 18px;
      left: 18px;
      text-align: center;
      background-color: #BCDBEA;
      border-radius: 50%;
      width: 24px;
      height: 24px;
      font-size: 14px;
      line-height: 26px;
      cursor: default;
    }
    
    .help-tip:before {
      content: '?';
      font-weight: bold;
      color: #fff;
    }
    
    .help-tip:hover span {
      display: block;
      transform-origin: 100% 0%;
      -webkit-animation: fadeIn 0.3s ease-in-out;
      animation: fadeIn 0.3s ease-in-out;
    }
    
    .help-tip span {
      display: none;
      text-align: left;
      background-color: #1E2021;
      padding: 5px;
      width: 200px;
      position: absolute;
      border-radius: 3px;
      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
      left: -4px;
      color: #FFF;
      font-size: 13px;
      line-height: 1.4;
    }
    
    .help-tip span:before {
      position: absolute;
      content: '';
      width: 0;
      height: 0;
      border: 6px solid transparent;
      border-bottom-color: #1E2021;
      left: 10px;
      top: -12px;
    }
    
    .help-tip span:after {
      width: 100%;
      height: 40px;
      content: '';
      position: absolute;
      top: -40px;
      left: 0;
    }
    
        	 This is the inline help tip! 
    

提交回复
热议问题