在悬停引导程序上更改不透明度

时间:2016-07-22 04:35:32

标签: css html5 twitter-bootstrap

<button type="submit" value="Log in" class="btn btn-lg btn-link" style="color: grey;"><i class="glyphicon glyphicon-log-in" style="font-size: xx-large"></i></button>

我添加了内联样式来更改按钮样式属性。现在,当我将鼠标指针悬停在它上面时,它不会改变不透明度。有没有办法指定?我正在使用twitter bootstrap 3.0

4 个答案:

答案 0 :(得分:1)

我会创建自己的css类,使用:hover然后设置html元素的opacity属性,如下所示:

.btn-opacity:hover {
    opacity: 0.5;
    filter: alpha(opacity=50); /* For IE8 and earlier */
}
.btn-opacity {
    opacity: 1.0;
    filter: alpha(opacity=100); /* For IE8 and earlier */
}

答案 1 :(得分:1)

您可以尝试在CSS中添加该功能

button:hover{
  opacity: .5;
}

但是这指定当你悬停时所有按钮的不透明度都会变为50%,我不确定这是否有帮助!

答案 2 :(得分:1)

.btn-link:hover{
    opacity: 0.5;
}

您需要为.btn-link添加不透明度,这样才不会影响您网站中的所有按钮

答案 3 :(得分:1)

内联方法 这对你有用..

<button onmouseover = "this.style.opacity = '0.5'" onmouseout = "this.style.opacity = '1'" type="submit" value="Log in" class="btn btn-lg btn-link" style="color: grey;"><i class="glyphicon glyphicon-log-in" style="font-size: xx-large"></i>submit</button>
相关问题