在工具提示中插入html标签

时间:2018-06-26 08:34:22

标签: html css tooltip attr

我想通过按钮创建工具提示,但是我无法插入html标签来进行换行。谁能帮我解决这个问题?

[data-title]:hover:after {
  opacity: 1;
  transition: all 0.1s ease 0.5s;
  visibility: visible;
}

[data-title]:after {
  content: attr(data-title);
  position: absolute;
  bottom: -3em;
  right: 40%;
  padding: 4px 4px 4px 8px;
  color: grey;
  white-space: nowrap;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  -moz-box-shadow: 0px 0px 4px deepskyblue;
  -webkit-box-shadow: 0px 0px 4px deepskyblue;
  box-shadow: 0px 0px 4px deepskyblue;
  background-image: -moz-linear-gradient(top, #fff, #fff);
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #cccccc));
  background-image: -webkit-linear-gradient(top, #fff, #fff);
  background-image: -moz-linear-gradient(top, #fff, #fff);
  background-image: -ms-linear-gradient(top, #fff, #fff);
  background-image: -o-linear-gradient(top, #fff, #fff);
  opacity: 0;
  z-index: 99999;
  visibility: hidden;
  font-size: 11px;
}

[data-title] {
  position: relative;
}
<a href="<?=get_the_permalink()?>">
  <button class="btn" data-title="1) A <br> 2) B">Lihat Detail</button>
</a>

0 个答案:

没有答案