0

I can't make box shadow in chrome to work, I used webkit prefix but still I get orange frame around my tag instead I should get gray shadow. This is working in all browsers except Chrome.

.loginForm input[type='text']:focus, .loginForm input[type='password']:focus,
.registerForm input[type='text']:focus, .registerForm input[type='password']:focus{
    box-shadow: 0 0 10px gray;
    -webkit-box-shadow: 0 0 10px gray;
}
j08691
  • 204,283
  • 31
  • 260
  • 272
Alen
  • 897
  • 2
  • 15
  • 33

2 Answers2

1

This looks okay for me, but I think what you are seeing is the outline proprety on focus obscuring the shadow.

.selector {
    outline: 0;
    box-shadow: 0 0 10px gray;
}

http://jsfiddle.net/VKkng/

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
1

You need to change the order in which you declare the box shadow properties - the unprefixed version should come last, like this:

.loginForm input[type='text']:focus, 
.loginForm input[type='password']:focus,
.registerForm input[type='text']:focus, 
.registerForm input[type='password']:focus{
    -webkit-box-shadow: 0 0 10px gray;
    box-shadow: 0 0 10px gray;

    /* Remove the orange focus border */
    outline: 0;
}

The orange border is Chrome's default focus style and can be removed with outline: 0 as shown above. More information can be found in this answer.

Community
  • 1
  • 1
Bojangles
  • 99,427
  • 50
  • 170
  • 208