如何在Bootstrap 4中使卡片看起来像这样?

时间:2019-02-21 05:23:25

标签: html css bootstrap-4

enter image description here

颜色和图标种类无关紧要。主要目标是左侧的大图标和右侧的大文本。

3 个答案:

答案 0 :(得分:1)

请看看

body{
    margin-top:20px;
    background:#FAFAFA;
}
.order-card {
    color: #fff;
}

.bg-c-blue {
    background: linear-gradient(45deg,#4099ff,#73b4ff);
}

.card {
    border-radius: 5px;
    -webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
    box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
    border: none;
    margin-bottom: 30px;
    -webkit-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
}

.card .card-block {
    padding: 25px;
}

.order-card i {
    font-size: 26px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="container">
    <div class="row">
        <div class="col-md-4 col-xl-3">
            <div class="card bg-c-blue order-card">
                <div class="card-block">
                    
                    <h2 class="text-right"><i class="fa fa-cart-plus float-left"></i><span>486</span></h2>
         
                </div>
            </div>
        </div>
        

	</div>
</div>

答案 1 :(得分:1)

Fiddle

<div class="card w-50">
  <div class="card-body d-flex justify-content-between">
      <div class="display-3 d-flex">
        <i class="fa fa-cart-plus"></i>
      </div>
      <div class="d-flex flex-column">
        <div class="h2 mb-0">+562</div>
        <div class="h4 font-weight-lighter mb-0">Total sells</div>
      </div>
  </div>
</div>

答案 2 :(得分:0)

看看它1

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <style>
        .cart-box{max-width:500px;padding:15px;background:#e9f0f9;}
        .cart-holder{padding:10px;color:#fff;background:#009dc6;}
        .cart-holder .icon-holder{font-size:50px;}
        .cart-holder .text-holder span{display: block;}
        .cart-holder .items-counter{font-size:28px;font-weight:bold;}
        .cart-holder .items-text{font-size:20px;}
    </style>
</head>
<body>
    <div class="cart-box">
        <div class="cart-holder">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6 col-6">
                        <div class="icon-holder">
                            <i class="fa fa-shopping-cart"></i>
                        </div>
                    </div>
                    <div class="col-sm-6 col-6">
                        <div class="text-holder text-right">
                            <span class="items-counter">+562</span>
                            <span class="items-text">Today Sells</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>