2017-09-26 82 views
2

我使用角度引導,但面板無法正常工作。我可以確認這些文件在正確的位置。 files 這是它的樣子:result 我可以使用btn和btn-primary,但不能使用面板。什麼可能導致這個問題?bootstrap面板不能正常工作

<html> 
    <head> 
     <link rel="stylesheet" href="css/bootstrap.css"> 
     <script type="text/javascript" src="js/bootstrap.min.js"></script> 
    </head> 
    <body> 
     <div class="panel panel-default"> 
      <div class="panel-body"> 
      Basic panel example 
      </div> 
     </div> 
     <button class="btn btn-success">test</button> 
    </body> 
</html> 

回答

6

,如果你使用的是引導4閱讀本

Panels, thumbnails, and wells 
Dropped entirely for the new card component. 

Panels 
.panel to .card, now built with flexbox. 
.panel-default removed and no replacement. 
.panel-group removed and no replacement. .card-group is not a replacement, it is different. 
.panel-heading to .card-header 
.panel-title to .card-title. Depending on the desired look, you may also want to use heading elements or classes (e.g. <h3>, .h3) or bold elements or classes (e.g. <strong>, <b>, .font-weight-bold). Note that .card-title, while similarly named, produces a different look than .panel-title. 
.panel-body to .card-block 
.panel-footer to .card-footer 
.panel-primary to .card-primary and .card-inverse (or use .bg-primary on .card-header) 
.panel-success to .card-success and .card-inverse (or use .bg-success on .card-header) 
.panel-info to .card-info and .card-inverse (or use .bg-info on .card-header) 
.panel-warning to .card-warning and .card-inverse (or use .bg-warning on .card-header) 
.panel-danger to .card-danger and .card-inverse (or use .bg-danger on .card-header) 

https://v4-alpha.getbootstrap.com/migration/#panels-thumbnails-and-wells

+0

是的,這是我的問題,我沒有知道他們做了這個改變,謝謝! – MStimp

2

自舉4,panels有利於被droppedcards

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/> 
 

 

 
<div class="card" style="width: 20rem;"> 
 
    <div class="card-body"> 
 
    <h4 class="card-title">Card title</h4> 
 
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> 
 
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> 
 
    <a href="#" class="card-link">Card link</a> 
 
    <a href="#" class="card-link">Another link</a> 
 
    </div> 
 
</div>

0

我建議你添加一個所有面板項目,我認爲你應該添加面板標題和麪板頁腳以及一個容器。

<html> 
<head> 
    <link rel="stylesheet" href="css/bootstrap.css"> 
    <script type="text/javascript" src="js/bootstrap.min.js"></script> 
</head> 
<body> 
    <div class="container"> 
    <div class="box"> 

     <div class="panel panel-default"> 
      <div class="panel-heading"> 
      <p>This a title</p> 
      </div> 
      <div class="panel-body"> 
       Basic panel example 
      </div> 
      <div class="panel-footer"> 
      <button class="btn btn-success">test</button> 
      </div> 
     </div> 

    </div> 
    </div> 
</body> 

0

命中:CTRL + SHIFT + I或右鍵單擊並選擇[檢查,然後單擊控制檯,以確保您不要有問題,JavaScript文件被稱爲 和該bootstrab,但在該代碼HTML文件

<div class="panel panel-default"> 
    <div class="panel-heading">Panel heading without title</div> 
    <div class="panel-body"> 
    Panel content 
    </div> 
</div> 

<div class="panel panel-default"> 
    <div class="panel-heading"> 
    <h3 class="panel-title">Panel title</h3> 
    </div> 
    <div class="panel-body"> 
    Panel content 
    </div> 
</div> 

,但在body標籤後,你的bootstrap.js文件