在按钮控件医嘱列表启动中添加工具提示

zlwx9yxi  于 2021-09-13  发布在  Java
关注(0)|答案(1)|浏览(319)

我尝试在控件按钮顺序列表中添加工具提示
我的组件

Component({
  selector: 'app-block',
  templateUrl: './block.component.html',
  styleUrls: ['./block.component.css'],
  styles:[`
    button[icon="pi pi-angle-double-up"] {
      /* what should I write here */
    }
  `],
  encapsulation: ViewEncapsulation.None
})

那么,有没有其他方法向我想要的按钮添加工具提示,或者使用css的正确方法是什么?

agyaoht7

agyaoht71#

您需要自定义block.component.html和block.component.css,如下所示:

.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  /* Position the tooltip */
  position: absolute;
  z-index: 1;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}
<html>

<body style="text-align:center;">

  <p>Move the mouse over the text below:</p>

  <div class="tooltip">Hover over me
    <span class="tooltiptext">Tooltip text</span>
  </div>

</body>

</html>

相关问题