4

我正在尝试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;}
4

2 回答 2

4

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

在此处输入图像描述

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

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

于 2017-01-05T21:59:41.707 回答
3

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

.book .book-body .page-wrapper .page-inner section.normal .rmdcomment a:hover {
    text-decoration: underline;
    font-weight: bold;
    color: white;
}
于 2017-01-05T22:08:27.503 回答