简体   繁体   English

引导面板无法显示,但导航栏和页脚在Angular4应用中正常工作?

[英]Bootstrap panels failing to display but navbar and footer work in Angular4 app?

So I have an angular4 app I'm building with an app.component.html that looks like this: 所以我有一个angular4应用我与全面建设app.component.html ,看起来像这样:

 <app-nav></app-nav> <div class="container"> <div class="panel panel-primary"> <div class="panel-heading"> TEST HEAD </div> </div> </div> <app-footer></app-footer> 

The nav.component.html looks like this: nav.component.html看起来像这样:

 <nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse fixed-top"> <a class="navbar-brand" href="#">Welcome!</a> <ul class="nav navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" routerLink="home" [routerLinkActive]="['active']"> Home <!--<span class="sr-only">(current)</span>--> </a> </li> <li class="nav-item"> <a class="nav-link" routerLink="contact" [routerLinkActive]="['active']"> Contact </a> </li> </ul> <ul class="nav navbar-nav"> <li class="nav-item"> <a class="nav-link" href="https://twitter.com/dril" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a> </li> <li class="nav-item"> <a class="nav-link" href="https://github.com/dril" target="_blank"><i class="fa fa-github" aria-hidden="true"></i></a> </li> </ul> </nav> <router-outlet></router-outlet> 

And a footer.component.html that looks like this: footer.component.html看起来像这样:

 <footer class="footer"> <div class="container"> <span class="text-muted"> Footer </span> </div> </footer> 

As you can see, I'm using bootstrap and font-awesome to style everything, in addition to a global styles.css that looks like this: 如您所见,除了使用如下所示的全局styles.css之外,我还在使用bootstrap和font-awesome来设置所有内容的样式:

 html { position: relative; min-height: 100%; } body { padding-top: 5rem; } .starter-template { padding: 3rem 1.5rem; text-align: center; } 

The nav and footer components are styling correctly. 导航和页脚组件的样式正确。 However, the panel styles do not seem to be applying in the main app.component.html or anywhere else I'm testing panels. 但是, panel样式似乎没有应用在主app.component.html或我正在测试的其他任何面板中。

What gives? 是什么赋予了?

You tagged bootstrap 4. If you really use bootstrap 4, it's normal that panel class doesnt have a style because for bootstrap 4 you should use card to make a panel style : https://v4-alpha.getbootstrap.com/components/card/ 您标记了bootstrap4。如果您确实使用bootstrap 4,则通常面板类没有样式,因为对于bootstrap 4,您应该使用card来制作面板样式: https : //v4-alpha.getbootstrap.com/components/card /

Should be: 应该:

<div class="card">
  <div class="card-header">
    Quote
  </div>
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>

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

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