【问题标题】:Is there any props to change text style(i.e. bold to unbold) in React tooltip?是否有任何道具可以在 React 工具提示中更改文本样式(即粗体到非粗体)?
【发布时间】:2020-04-06 12:51:13
【问题描述】:

任何人都可以向我解释如何在react-tooltip 中将粗体文本变为非粗体。我用过 npm react-tooltip

注意:默认文本是粗体我想要普通文本。

【问题讨论】:

  • 您可以通过将font-weight: normal; 轻松分配给您的工具提示类来实现此目的。

标签: javascript reactjs npm web-applications react-tooltip


【解决方案1】:

您可以使用 react-tooltip 使用的 data 属性应用 font-weight: normal

a[data-tip] {
  font-weight: normal;
}

【讨论】:

  • 我相信这只会改变Text的风格,而不是Tooltip
【解决方案2】:

您可以通过API of ReactTooltip自定义文本样式

<ReactTooltip textColor={"lightblue"} backgroundColor={"white"} />

或者干脆使用!important

.Tooltip {
  color: red !important;
}
<ReactTooltip className="Tooltip" />

在其文档演示中建议:

.extraClass {
  font-size: 20px !important;
  pointer-events: auto !important;
}
.extraClass:hover {
  visibility: visible !important;
  opacity: 1 !important;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-07
    • 1970-01-01
    相关资源
    最近更新 更多