-4

I need to add a css code that only applies to google chrome but not to firefox.

Problem: I want to put a border-bottom to a div with a class of .div-special

 .div-special{
      border-bottom: 1px solid #c8c8c8;
 }

Output: The border bottom should only apply for google chrome browser but not to firefox.

Please help me.

Redshot
  • 13
  • 2

3 Answers3

2
@media screen and (-webkit-min-device-pixel-ratio:0) { 
 .div-special{
      border-bottom: 1px solid #c8c8c8;
 }
}
Anton
  • 9,682
  • 11
  • 38
  • 68
1

You can try this

@media screen and (-webkit-min-device-pixel-ratio:0) {
    .class{color:red;}
}

/* Safari only override */
::i-block-chrome,.class {
 color:blue;
}}

OR

@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
    .class {
       color:red;
    }
}

JQuery using User Agent

if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
    $('.container').hide();
}
Benjamin
  • 2,612
  • 2
  • 20
  • 32
0
@media screen and (-webkit-min-device-pixel-ratio:0) {
   // your CSS here
}
Raja Sekar
  • 2,062
  • 16
  • 23