仅在特殊div中使用bootstrap

时间:2015-02-26 13:29:48

标签: css html5 css3 twitter-bootstrap twitter-bootstrap-3

我在我的TYPO3前端插件中使用bootstrap,但我只想在特殊的div中使用它,这样才能从引导类中触及类without_bootstrap

例如

<div class="without_bootstrap">
     <div class="with_bootstrap">
     </div>
</div>

这可能吗?

1 个答案:

答案 0 :(得分:2)

部分。如果你避免使用bootstrap使用的类名,你应该没问题。但是bootstrap定义了一些特定于标签的样式,例如

a {
  background-color: transparent
}

你可以通过定义这样的风格来避免这种情况:

.without-bootstrap > a {
  /* whatever */
}

示例:

&#13;
&#13;
.wrapper {
  background-color:#f00;
}
.no-bootstrap > a {
  background-color:#fff;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="wrapper">
  <div class="no-bootstrap">
    <a href="#"> No Bootstrap</a>
    <div class="bootstrap">
      <a href="#"> With Bootstrap</a>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

另一种解决方案可能是根据您的需求自定义引导程序: http://getbootstrap.com/customize/