Bootstrap tooltip arrow border and background color

前端 未结 2 1270
隐瞒了意图╮
隐瞒了意图╮ 2021-01-25 12:51

How do I change the background color and border color of the tooltip arrow? I\'m using Bootstrap 4.

2条回答
  •  不知归路
    2021-01-25 13:47

    Add another pseudo element that will cover the first one and you translate it slightly to create the needed visual

    $(function() {
      $('[data-toggle="tooltip"]').tooltip()
    })
    .tooltip-main {
      width: 15px;
      height: 15px;
      border-radius: 50%;
      font-weight: 700;
      background: #f3f3f3;
      border: 1px solid #737373;
      color: #737373;
      margin: 4px 121px 0 5px;
      float: right;
      text-align: left !important;
    }
    
    .tooltip-qm {
      float: left;
      margin: -2px 0px 3px 4px;
      font-size: 12px;
    }
    
    .tooltip-inner {
      max-width: 236px !important;
      height: 76px;
      font-size: 12px;
      padding: 10px 15px 10px 20px;
      background: #FFFFFF;
      color: rgb(0, 0, 0, .7);
      border: 2px solid red;
      text-align: left;
    }
    
    .tooltip.show {
      opacity: 1;
    }
    
    .bs-tooltip-auto[x-placement^=bottom] .arrow::before,
    .bs-tooltip-bottom .arrow::before {
      border-bottom-color: #f00!important;
      /* Red */
    }
    
    .bs-tooltip-bottom .arrow::after {
        content: "";
        position: absolute;
        bottom: 0;
        border-width: 0 .4rem .4rem;
        transform: translateY(3px);
        border-color: transparent;
        border-style: solid;
        border-bottom-color: #000;
    }
    
    
    
    
    ?

提交回复
热议问题