【问题标题】:style links in a custom block in bookdownbookdown中自定义块中的样式链接
【发布时间】:2017-05-20 14:22:27
【问题描述】:

我正在尝试设置custom block in bookdown 中的链接样式。自定义块类型称为“rmdcomment”,我在style.css 文件中添加了以下内容:

.rmdcomment {
  padding: 1em 1em 1em 4em;
  margin-top: 30px;
  margin-bottom: 30px;
  background: #1f9ac9;
  position:relative;
  color: white;
}

.rmdcomment:before {
  content: "\f075";
  font-family: FontAwesome;
  left:10px;
  position:absolute;
  top:0px;
  font-size: 45px;
  color: white;
}

以上显示正确。

我还在(不成功的)尝试设置链接样式时添加了以下内容:

.rmdcomment a:link {text-decoration: underline; font-weight:bold; color:white;}
.rmdcomment a:visited {text-decoration: underline; font-weight:bold; color:white;}
.rmdcomment a:hover {text-decoration: underline; font-weight:bold; color:white;}

【问题讨论】:

  • 我在您的 HTML 中找不到 rmdcomment
  • 试试颜色:白色;
  • 对不起,链接是自定义块的bookdown包描述。你可以在这里看到它:designsandmethods.com/ebook/…
  • 谢谢@Valius79。错字。已更正,但问题仍然存在。

标签: css r knitr bookdown


【解决方案1】:

我相信这就是你所说的部分。

添加 !important,所以基本上你会覆盖以前的样式。

.rmdcomment a:link {text-decoration: underline !important; font-weight:bold !important; color:white !important;}

【讨论】:

    【解决方案2】:

    使用 !important 不是最佳做法。你总是可以更具体地使用你的 CSS。尝试像这样定位,你应该得到相同的结果,而不使用!重要:

    .book .book-body .page-wrapper .page-inner section.normal .rmdcomment a:hover {
        text-decoration: underline;
        font-weight: bold;
        color: white;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-03
      • 2012-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多