Bootstrap less - 覆盖整个类

时间:2015-04-16 11:54:42

标签: css twitter-bootstrap less

我正在使用Bootstrap less文件。我宁愿不直接修改它们,因为这似乎是不好的做法。 我正在编辑的唯一文件是bootstrap.less,因为我需要添加覆盖类。

type.less我要修改此内容:

.page-header {
  padding-bottom: ((@line-height-computed / 2) - 1);
  margin: (@line-height-computed * 2) 0 @line-height-computed;
  border-bottom: 1px solid @page-header-border-color;
}

所以我创建了一个包含此内容的新_type.less

.page-header {
  background: blue;
}

这在主bootstrap.less文件中引用:

@import "type.less";
@import "../bootstrap-custom/_type.less";

我遇到的问题是编译器将两个类输出到bootstrap.css - 我想覆盖原始类,以便它只使用我的实现。

这可能吗?

1 个答案:

答案 0 :(得分:0)

不要在主引导程序中调用你的少量内容,在较少文件的顶部调用bootstrap.less。

此外,您还需要覆盖.page-header

中的每个定义
.page-header {
     padding-bottom: 0;
     margin: 0;
     border-bottom: none;
     background: blue;
   }