css - 个性化 Bootstrap 主题?

标签 css twitter-bootstrap drupal

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 6 年前

我使用“Font Awesome”在 bootstrap 上创建了一个篮子。

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

最佳答案

你在找这个吗

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;
}


}

关于css - 个性化 Bootstrap 主题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41769706/

上一篇:html - 当您调整浏览器窗口的高度时,页脚不在页面的最底部

下一篇:css - 什么是 CSS 的 base 64 字体

相关文章:

javascript - 使用媒体查询仅包含移动设备上的 JS 文件

CSS 悬停选择器不起作用

jquery - 单击图像以在 Rails 中启动搜索

javascript - flex 盒元素无法在 Chrome 上正确重新呈现

css - Bootstrap 无法正常工作

html - 如何删除 bootstrap 3.0 中的 <td> 边框?

mysql - 在 drupal 中使用枚举

css - 如何仅使用 bootstrap 3 网格系统和 css 创建 masonry 效果

php - 修改 Drupal Views 分页以限制显示的页码

图像类型作为 drupal-7 中的背景