• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Other / Browser specific CSS in Angular

Browser specific CSS in Angular

npm install ngx-device-detector --save
export class AppComponent implements OnInit {
isChrome: boolean;
isFirefox: boolean;

private readonly _deviceDetectorService = inject(DeviceDetectorService);

ngOnInit() {
const browser = this.deviceService.browser;
this.isChrome = browser === 'Chrome';
this.isFirefox = browser === 'Firefox';

console.log(`Is Chrome: ${this.isChrome}`);
console.log(`Is Firefox: ${this.isFirefox}`);
}
}
export class AppComponent implements OnInit {
isChrome: boolean;
isFirefox: boolean;

constructor(private deviceService: DeviceDetectorService) {}

ngOnInit() {
const browser = this.deviceService.browser;
this.isChrome = browser === 'Chrome';
this.isFirefox = browser === 'Firefox';

console.log(`Is Chrome: ${this.isChrome}`);
console.log(`Is Firefox: ${this.isFirefox}`);
}
}

Filed Under: Other

About Gabor Flamich

I'm a web developer and designer based in Budapest, Hungary. In recent years, I've documented hundreds of solutions I came across during development. This site is an archive for useful code snippets on WordPress, Genesis Framework and WooCommerce. If You have any questions related to WordPress development, get in touch!

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved