使数据工具提示文本的一部分变为粗体

时间:2015-07-20 10:03:42

标签: html css

我试图找出data-tooltip的工作原理。现在我想知道是否有可能只是将数据工具提示的一部分加粗,在这种情况下我想在链接中使“blabla”加粗?或者这种情况还有其他解决方法吗?

HTML:

<span class="social-help" data-tooltip="Your username is the last part of the link ex: http://facebook.com/blabla">
    <i class="fa fa-question"></i>
</span>

CSS:

/* Add this attribute to the element that needs a tooltip */
[data-tooltip] {
  position: relative;
  z-index: 2;
  cursor: pointer;
}

/* Hide the tooltip content by default */
[data-tooltip]:before,
[data-tooltip]:after {
  visibility: hidden;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
  opacity: 0;
  pointer-events: none;
}

/* Position tooltip above the element */
[data-tooltip]:before {
  position: absolute;
  bottom: 150%;
  left: 50%;
  margin-bottom: 5px;
  margin-left: -80px;
  padding: 10px;
  min-width: 160px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  background-color: #313d45;
  color: #fff;
  content: attr(data-tooltip);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

/* Triangle hack to make tooltip look like a speech bubble */
[data-tooltip]:after {
  position: absolute;
  bottom: 150%;
  left: 50%;
  margin-left: -5px;
  width: 0;
  border-top: 5px solid #313d45;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: " ";
  font-size: 0;
  line-height: 0;
}

/* Show tooltip content on hover */
[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
  visibility: visible;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
  opacity: 1;
}

0 个答案:

没有答案