简体   繁体   English

与主要的CSS搞砸了引导CSS

[英]with main css messed up bootstrap css

I am trapped in the hole of bootstrap css messed up with my application main css. 我陷入了与我的应用程序主CSS混淆的bootstrap css的孔中。

I am using angular-bootstrap'popover, but the popover's arrow was messed up. 我正在使用angular-bootstrap'popover,但是popover的箭头弄乱了。 like this: 像这样:

在此处输入图片说明

and the css: 和CSS:

在此处输入图片说明

the css '.card .card-panel .card-body .arrow' is the css in my main css file. CSS'.card .card-panel .card-body .arrow'是我的主要CSS文件中的CSS。 and the '.test-popover .popover.right > .arrow' is what i am wanted! 我想要的是'.test-popover .popover.right> .arrow'! I don't why the main css has the higher priority! How can I solve this? 我不知道为什么主CSS具有更高的优先级!我该如何解决呢?


Finally I reappeared this see here Plunker 最后,我再次出现此看到这里Plunker

the main.css is like this main.css是这样的

.card .card-panel .card-body .arrow {
  float: right;
  display: inline-block;
  height: 26px;
  width: 26px;
  background-size: 14px 9px;
  background-position: 4px 6px;
  border-radius: 13px;
  border: 2px solid #f00;
  cursor: pointer;
}

Delete all of the Bootstrap card related HTML and it works as expected. 删除所有与Bootstrap card相关的HTML,它会按预期工作。

<div ng-app="my-app" ng-controller="controller">
  <div class="container-fluid">
    <div class="row">
      <div class="col-xs-12" style="text-align:center;">
        <h2>Here is a list a weapons</h2>
      </div>
    </div>
    <div class="row" ng-repeat="item in weaponItems">
      <div class="col-xs-12"> <!-- not needed -->
        <div class="col-xs-6" ng-click="selectItem(item)" uib-popover-template="'popover.html'" popover-is-open="isOpen && item === selectedItem" popover-trigger="click" popover-placement="right">
          <div class="panel">
            <div class="panel-body" style="min-height:120px;">
              <div><b>Category:</b>&nbsp;{{item.title}}</div>
              <p><b>Desc:</b>&nbsp;{{item.desc}}</p>
            </div>
          </div>
        </div>
        <div class="col-xs-6">
          <div class="panel" style="text-align:center;">
            <img src="{{item.img}}" height="120px" width="auto">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

The spacing will be slightly different but you can correct that by removing the superfluous .col-xs-12 wrapper within <div class="row" ng-repeat="item in weaponItems"> . 间距会稍有不同,但是您可以通过删除<div class="row" ng-repeat="item in weaponItems">多余的.col-xs-12包装器来纠正此问题。 The .row is handling that stuff. .row正在处理这些东西。 Having nested cols like that is what causes the extra padding. 像这样嵌套cols是导致额外填充的原因。

One possible solution is to load your main css after bootstrap 一种可能的解决方案是在引导后加载主CSS

<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="main.css">

This will overwrite bootstrap css by your main css 这将覆盖您的主要CSS的引导CSS

I finally solved this problem! 我终于解决了这个问题! I added a more specificity css sheet to my popover, solved this perfectly! 我在弹出窗口中添加了一个更具特异性的CSS工作表,完美解决了这个问题! Thanks for all your help! 感谢你的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM