2017-01-20 3 views
-1

"Font Awesome"を使ってブートストラップにバスケットを作成しました。ブートストラップテーマをパーソナライズしますか?

1)バッジを赤で書くにはどうすればいいですか?

2)バッジをカートに入れる方法は?

<a href="/cart"> 
<i class="fa fa-shopping-cart fa-3x"></i> 
<span class="badge">[quantity]</span> 
<span>[commerce_order_total]</span> 
</a> 

enter image description here

+1

を試してみましたか?何がうまかった?どうしたの? SOはコード作成サービスではありません。 – hungerstar

答えて

1

あなたはこの

https://plnkr.co/edit/tL6GLun9iG5R9ifaaG74?p=preview

を探している私はちょうどあなたのトリミングを行い、ニーズ

のために調整し、私はすでに使用されどのようなコードの一部を貼り付けコピー

HTML

<!DOCTYPE html> 
<html> 

<head> 
    <link rel="stylesheet" href="style.css"> 
    <script src="script.js"></script> 
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> 
</head> 

<body> 
    <a href="#" class="btn btn-default btn-lg"> 
    <i class="fa fa-shopping-cart fa-3x"></i> 
    <span class="bs-badge badge-absolute float-right badge-red">87</span> 
    </a> 
</body> 

</html> 

CSSあなたは何を

/* Styles go here */ 

a { 
    outline: 0; 
} 

.btn { 
    border-radius: 3px; 
    font-weight: 400; 
    position: relative; 
    display: inline-block; 
    padding: 0 12px; 
    cursor: pointer; 
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    user-select: none; 
    text-align: center; 
    white-space: nowrap; 
    border-width: 1px; 
    border-style: solid; 
    border-color: transparent; 
    background-image: none; 
} 


.fa { 
    color: green; 
} 

.btn-lg { 
    font-size: 18px; 
    padding: 0 16px; 
    line-height: 44px; 
    min-width: 56px; 
    height: 46px; 
} 

.bs-badge.badge-absolute.float-right { 
    right: -4px; 
    left: auto; 
} 

.bs-badge.badge-absolute { 
    position: absolute; 
    z-index: 5; 
    top: -6px; 
    left: -15px; 
} 

.bs-badge { 
    font-size: 11px; 
    font-weight: 700; 
    line-height: 19px; 
    display: inline-block; 
    min-width: 20px; 
    height: 20px; 
    padding: 0 4px 0 5px; 
    text-align: center; 
    vertical-align: baseline; 
    white-space: nowrap; 
    color: #fff; 
    border-radius: 10px; 
} 

.badge-red { 
    background: red; 
    border-color: #7a3ecc; 
} 


} 
+0

更新済みPlunker https://plnkr.co/edit/XyrIOJAQnfcTPhhkki8V?p=preview –

+0

ありがとうございました。しかし、それをショッピングカートの中に入れる方法は? – Mathieu

+0

あなたはそのアイコンの内側に@Mathieu –

関連する問題