【问题标题】:How to change the font color in alertify.error using alertify.js如何使用 alertify.js 更改 alertify.error 中的字体颜色
【发布时间】:2015-12-15 12:29:30
【问题描述】:

我正在使用 alertify.error 来显示错误消息。我想知道是否有任何方法可以更改里面显示的文本的字体颜色?

【问题讨论】:

标签: jquery css alertifyjs


【解决方案1】:

嗯,正如我所看到的,它使用此代码来更改字体颜色和整体字体样式:

.alertify-notifier .ajs-message.ajs-error{
    color: #fff;
    background: rgba(217, 92, 92, 0,95);
    text-shadow: -1px -1px 0 rgba(0, 0, 0, 0,5);
}

因此,如果您想更改字体颜色,只需将其添加到您自己的 css 中:

.alertify-notifier .ajs-message.ajs-error{
    color: #yourcolor;
}

注意:可能需要 !important 来覆盖 alertify css。不先尝试。

【讨论】:

  • 谢谢基斯。有效。我没有使用!important,但它有效。非常感谢!
【解决方案2】:

要么更新你正在使用的主题,要么覆盖消息 CSS 规则,默认主题使用以下规则:

.alertify-notifier .ajs-message {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  text-align: center;
  border: solid 1px #ddd;
  border-radius: 2px;
}
.alertify-notifier .ajs-message.ajs-success {
  color: #fff;
  background: rgba(91, 189, 114, 0.95);
  text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5);
}
.alertify-notifier .ajs-message.ajs-error {
  color: #fff;
  background: rgba(217, 92, 92, 0.95);
  text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5);
}
.alertify-notifier .ajs-message.ajs-warning {
  background: rgba(252, 248, 215, 0.95);
  border-color: #999;
}

要更改特定消息类型的字体颜色,请覆盖它的相应规则:

.alertify-notifier .ajs-message.ajs-success{
      color: blue;
}

【讨论】:

  • 感谢您的帮助!
猜你喜欢
  • 2017-01-10
  • 1970-01-01
  • 1970-01-01
  • 2015-05-18
  • 2011-05-20
  • 1970-01-01
  • 2012-02-20
  • 2011-06-19
  • 1970-01-01
相关资源
最近更新 更多