html - Bootstrap maxcdn 影响我的 CSS。请帮我解决

标签 html css twitter-bootstrap

我在 jdFiddle 中试过这段代码

我将 .numberCircle 的宽度更改为 35px。

没有 Bootstrap CSS,它工作正常。但是,如果我使用 Bootstrap CSS,它就无法正常工作,如 jsFiddle 输出所示。

没有 Bootstrap CSS:

.numberCircle {
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  width: 35px;
  padding: 8px;
  font-size: 32px;
  line-height: 1em;
  border: 2px solid #666;
  position: relative;
}
.numberCircle .height_fix {
  margin-top: 100%;
}
.numberCircle .content {
  position: absolute;
  left: 0;
  top: 50%;
  height: 100%;
  width: 100%;
  text-align: center;
  margin-top: -16px;
  /* Note, this must be half the font size */
}
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">1</div>
</div>
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">100</div>
</div>
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">10</div>
</div>

使用 Bootstrap CSS:

.numberCircle {
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  width: 35px;
  padding: 8px;
  font-size: 32px;
  line-height: 1em;
  border: 2px solid #666;
  position: relative;
}
.numberCircle .height_fix {
  margin-top: 100%;
}
.numberCircle .content {
  position: absolute;
  left: 0;
  top: 50%;
  height: 100%;
  width: 100%;
  text-align: center;
  margin-top: -16px;
  /* Note, this must be half the font size */
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">1</div>
</div>
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">100</div>
</div>
<div class="numberCircle">
  <div class="height_fix"></div>
  <div class="content">10</div>
</div>

使用 Bootstrap CSS 的屏幕截图:

enter image description here

我在 Bootstrap CSS 中尝试了相同的代码,并将所有 div 放在单列和单行中,但它仍然无法正常工作。

请帮忙。

最佳答案

使用 Bootstrap CSS 更新 Css 类

.numberCircle {
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  width: 35px;
  padding: 40px;
  font-size: 32px;
  line-height: 1em;
  border: 2px solid #666;
  position: relative;
}

Demo JsFiddle

关于html - Bootstrap maxcdn 影响我的 CSS。请帮我解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38449451/

相关文章:

css - Twitter Bootstrap 模态宽度问题

html - 为什么我的 DIV 从页面上掉下来

javascript - 在同一行的三个 div 中将三个按钮居中

javascript - Bootstrap : Slideup/Slidedown or Accordion in Panel

html - Angular:组件获取输入数据后如何调用函数

javascript - 如何从一系列文本区域(用户输入)中获取平均数?

html - 响应式 App : which font-size units em vs. px vs. pt vs. percent

jquery - HTML5 : Why aren't people using "ContentEditable" for their websites Comment input?

html - 强制文本留在列 bootstrap 3 的底部

jquery - 从基本 HTML 和 CSS 转向 Bootstrap 或流体布局