0

我正在尝试在引导程序中设置样式和颜色按钮,但是当我更改颜色时,当悬停时,它会像这样:**编辑:我需要更多的声誉点来发布图像,但是当我将鼠标悬停在它上面时会发生什么,只有一半的所选颜色显示。我认为这与引导程序无法读取“渐变”有关。

这是怎么回事?这是我的代码:

.btn {
  display: inline-block;
  *display: inline;
  padding: 4px 12px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #ff0001;
  *background-color: red;
  background-image: -moz-linear-gradient(top, red, #e6e6e6);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ff0001), to(#ff0001));
  background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
  background-repeat: repeat-x;
  border: 1px solid #cccccc;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #b3b3b3;
  -webkit-border-radius: 4px;
     -moz-border-radius: 4px;
          border-radius: 4px;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='red', endColorstr='red', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
  *zoom: 1;
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
     -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
4

1 回答 1

0

Bootstrap 的按钮应用了背景位置:

.btn:hover {
background-position: 0 -15px;
-webkit-transition: background-position 0.1s linear;
-moz-transition: background-position 0.1s linear;
-o-transition: background-position 0.1s linear;
transition: background-position 0.1s linear;
}

您可以删除引导程序的主 css 文件中的样式。或者将其添加到您自己的 css 文件中:

.btn:hover {
background-position: 0px;
}
于 2013-08-03T02:20:13.073 回答