Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue on mouse hover in button

I'm using Twitter Bootstrap and I'm having some weird using when hovering over a btn-primary button.

This is my code :

<div class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
        <ul class="nav nav-pills">
      <li class="active">
        <a href="#">Home</a>
      </li>
      <li><a href="#">...</a></li>
      <li><a href="#">...</a></li>
      <li><a href="#" class="btn btn-primary btn-small">
                  <i class="icon-user icon-white"></i> Log In
                  </a>
              </li>
    </ul>
    </div>
  </div>
</div>

And this is what happens :

before

enter image description here

on hover

enter image description here


Any ideas why this could be happening?

like image 706
Dr.Kameleon Avatar asked Jul 07 '12 11:07

Dr.Kameleon


People also ask

When the mouse is hover over a button what appears?

A special usage of mouseover event is a tooltip which shows a short description of the object under the pointer. The tooltip appears only after the mouse or stylus is held over the object for a certain amount of time.

Can we hover with mouse?

Hovering is a fundamental digital action that involves placing the mouse cursor on the target link or button. Users mainly use the mouse hover action to access sub-menu items.

What is hovering your mouse?

Alternatively referred to as mouseover or mouse hover, hover describes the act of moving a mouse pointer over a clickable object, but not actually clicking the left or right mouse button. For example, when you hover your mouse over any of the links on this page, they should change color, indicating they can be clicked.


1 Answers

2 solutions,

  • Easy : Remove the a href from the li. Pro: fast, no maintenance. Con : can't do this if you need a dropdown, can break design.
  • Preferrable : add missing css classes to support btn within li.
.navbar .nav > li > a.btn {
display: inline-block; padding: 4px 10px 4px; margin: 5px 5px 6px; line-height: 18px;
}

.navbar .nav > li > a.btn-primary,
.navbar .nav > li > a.btn-primary:hover {
   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
  color: #ffffff;
}


.navbar .nav > li > a.btn-primary:active {
   color: rgba(255, 255, 255, 0.75);
}

 .navbar .nav > li > a..btn-primary {
  background-color: #0074cc;
  background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
  background-image: -ms-linear-gradient(top, #0088cc, #0055cc);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc));
  background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
  background-image: -o-linear-gradient(top, #0088cc, #0055cc);
  background-image: linear-gradient(top, #0088cc, #0055cc);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0055cc', GradientType=0);
  border-color: #0055cc #0055cc #003580;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.navbar .nav > li > a.btn-primary:hover,
.navbar .nav > li > a.btn-primary:active,
.navbar .nav > li > a.btn-primary.disabled,
.navbar .nav > li > a.btn-primary[disabled] {
  background-color: #0055cc;
}
.navbar .nav > li > a.btn-primary:active,
.navbar .nav > li > a.btn-primary.active {
  background-color: #004099 \9;
}
like image 168
maxmax Avatar answered Oct 27 '22 21:10

maxmax