使用Bootstrap中的card-header-tabs设置卡片标题中的导航链接的样式-
<div class="card-header"> <ul class="nav nav-tabs card-header-tabs"> <li class="nav-item"> <a class="nav-link active" href="#">Drupal Commerce</a> </li> <li class="nav-item"> <a class="nav-link" href="#">WooCommerce</a> </li> </ul> </div>
标题标签是使用nav-tabs和card-header-tabs类在无序列表上设置的,如上所示-
<ul class="nav nav-tabs card-header-tabs">
让我们看一个例子来学习如何创建Bootstrap 4卡头-
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>E-commerce Technologies</h2> <div class="card"> <div class="card-header"> <ul class="nav nav-tabs card-header-tabs"> <li class="nav-item"> <a class="nav-link active" href="#">Drupal Commerce</a> </li> <li class="nav-item"> <a class="nav-link" href="#">WooCommerce</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Prestashop</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Shopify</a> </li> </ul> </div> <div class="card-body"> <h5 class="card-title">Add title here</h5> <p class="card-text">Add content here</p> </div> </div> </div> </body> </html>