Forum Discussion

singalashwani's avatar
singalashwani
Copper Contributor
Oct 07, 2020

CSS hack for Edge browser

I want to apply some CSS styles only in Edge browser and not able to find any CSS hack that only targets Edge browser. I am using Microsoft Edge Version 85.0.564.68

 

Thanks.
  • singalashwani thanks for the question. I'm really curious why you want to do this. Is there a bug in Edge that you are working around that you don't see in Chrome? 

     

    -John

    • singalashwani's avatar
      singalashwani
      Copper Contributor

      johnjansen thanks for the follow-up. Actually, I am working on a full-page vertical scrollable infographic website where all the different slides are full-page background images and on top of that, I am placing absolutely positioned divs to align elements. The alignment of these divs are not same in Chrome and Edge. That's why, I was looking for a CSS only solution to target styles only for the Edge browser but was not finding anything, thanks

    • singalashwani's avatar
      singalashwani
      Copper Contributor

      msekmfb1 thanks for the solution. Its working. Also can you please guide me any CSS hack also if I don't want to use JS to detect the navigator.

      • msekmfb1's avatar
        msekmfb1
        Iron Contributor

        singalashwani There's no way to do that in pure CSS, you can add a class to document body based on browser name and use it in CSS, e.g. add "edge" class to body and add style like ".edge { ... }"

Resources