增加IcoFont

时间:2018-05-24 11:45:40

标签: html css angular bootstrap-4



    .navbar.height {
        min-height: 180px;
    }

    .navbar.height .nav.navbar-nav {
        min-height: 80px;
    }

    .navbar.height .nav.navbar-nav .nav-item {
        min-height: 80px;
    }

    .navbar.height .nav.navbar-nav .nav-item a {
        min-height: 50px;
    }

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">

    <div class="row">
      <div class="col-xl-12 col-lg-12  filter-bar">
        <nav class="navbar navbar-light bg-faded">
          <ul class="nav navbar-nav">
            <li class="nav-item ">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer']" role="tab" aria-expanded="false"
                ngbTooltip="Home">
              <i class="icofont icofont-home"></i>
              </a>
              <div class="slide"></div>
            </li>
            <li class="nav-item" *ngIf="jwtHelperService.isRole(['globaladmin','globaladminro','franchiseadmin'])">
              <a class="nav-link text-muted" href="javascript:;" (click)="custBranch1.show()" title="Create New Branch">
              <i class="icofont icofont-building"></i>New
              </a>
            </li>
          </ul>
        </nav>
        <nav class="navbar navbar-light height bg-faded m-b-30">
          <ul class="nav navbar-nav">
            <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab"
                aria-expanded="false" ngbTooltip="Dashboard">
              <i class="icofont icofont-chart icofont-4x-pie-alt text-muted"></i>
              </a>
              <div class="slide"></div>
            </li>
            <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab"
                aria-expanded="false" ngbTooltip="Dashboard">
              <i class="icofont icofont-chart-pie-alt text-muted"></i>
              </a>
              <div class="slide"></div>
            </li>
          </ul>
        </nav>
      </div>
    </div>
&#13;
&#13;
&#13;

如何在<li>个标记中居中<nav>个标记并增加其IcoFont大小?

我尝试将icofont-4x类添加到<i>标记,但它不起作用。

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">

    <div class="row">
      <div class="col-xl-12 col-lg-12  filter-bar">
        <nav class="navbar navbar-light bg-faded">
          <ul class="nav navbar-nav">
            <li class="nav-item ">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer']" role="tab" aria-expanded="false"
                ngbTooltip="Home">
              <i class="icofont icofont-home"></i>
              </a>
              <div class="slide"></div>
            </li>
            <li class="nav-item" *ngIf="jwtHelperService.isRole(['globaladmin','globaladminro','franchiseadmin'])">
              <a class="nav-link text-muted" href="javascript:;" (click)="custBranch1.show()" title="Create New Branch">
              <i class="icofont icofont-building"></i>New
              </a>
            </li>
          </ul>
        </nav>
        <nav class="navbar navbar-light height bg-faded m-b-30">
          <ul class="nav navbar-nav">
            <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab"
                aria-expanded="false" ngbTooltip="Dashboard">
              <i class="icofont icofont-chart icofont-4x-pie-alt text-muted"></i>
              </a>
              <div class="slide"></div>
            </li>
            <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
              <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab"
                aria-expanded="false" ngbTooltip="Dashboard">
              <i class="icofont icofont-chart-pie-alt text-muted"></i>
              </a>
              <div class="slide"></div>
            </li>
          </ul>
        </nav>
      </div>
    </div>

**CSS**
<style>
    .navbar.height {
        min-height: 180px;
    }

    .navbar.height .nav.navbar-nav {
        min-height: 80px;
    }

    .navbar.height .nav.navbar-nav .nav-item {
        min-height: 80px;
    }

    .navbar.height .nav.navbar-nav .nav-item a {
        min-height: 50px;
    }
</style>

3 个答案:

答案 0 :(得分:2)

你可以试试这个,

.nav-item .icofont{
  font-size: 30px;
}

答案 1 :(得分:2)

要水平居中li元素,请在justify-content-center上使用 nav

要更改特定元素的font-size,您需要使用CSS

.font-25px {
  font-size: 25px;
}
 <i class="icofont icofont-building font-25px"></i>

.font-25px {
  font-size: 25px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet"/>
<div class="row">
  <div class="col-xl-12 col-lg-12  filter-bar">
    <nav class="navbar navbar-light bg-faded justify-content-center font-25px">
      <ul class="nav navbar-nav">
        <li class="nav-item ">
          <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer']" role="tab" aria-expanded="false" ngbTooltip="Home">
            <i class="icofont icofont-home"></i>Home
          </a>
          <div class="slide"></div>
        </li>
        <li class="nav-item" *ngIf="jwtHelperService.isRole(['globaladmin','globaladminro','franchiseadmin'])">
          <a class="nav-link text-muted" href="javascript:;" (click)="custBranch1.show()" title="Create New Branch">
            <i class="icofont icofont-building"></i>New
          </a>
        </li>
      </ul>
    </nav>
    <nav class="navbar navbar-light height bg-faded m-b-30 justify-content-center font-25px">
      <ul class="nav navbar-nav">
        <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
          <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab" aria-expanded="false" ngbTooltip="Dashboard">
            <i class="icofont icofont-chart icofont-4x-pie-alt text-muted"></i>Price
          </a>
          <div class="slide"></div>
        </li>
        <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
          <a class="nav-link icon-list-demo" data-toggle="tab" [routerLink]="['/franchise/customer/details/dashboard']" role="tab" aria-expanded="false" ngbTooltip="Dashboard">
            <i class="icofont icofont-chart-pie-alt text-muted"></i>Product
          </a>
          <div class="slide"></div>
        </li>
      </ul>
    </nav>
  </div>
</div>

答案 2 :(得分:1)

  

制作中心li

1)将.nav-item.nav设为display: inline- block;

2)将.navbar设为text-align: center

.nav-item, ul.nav {
  display: inline-block;
}
.navbar {
  text-align: center;
}
  

对于图标大小,您可以增加font-size

i.icofont {
  font-size: 20px; // Change as per your requirement
}