Platform specific css in Ionic2


I want to style my element based on the platform it’s running. I tried .platform-ios .myClass{}, .platform-md .myClass{} as well as .ios{ .myClass{}} but nothing seemed to work. Is there any way to do this.


Have you tried the showWhen tag?

<ion-fab right bottom showWhen="android">
        <button ion-fab color="danger">
            <ion-icon name="add">

showWhen=“ios” respectably for ios.


I want to style the same div for both ios nd android. Won’t it be a double task if I use 2 divs with showWhen for both the platforms.


Ahh sorry, I tought you needed to hide/show items depending on the platform.

Have you tryed the samples from the documentation?

Example html:

<button class="special" ion-button block">
    Some text

and the scss:


	page-homepage {
			background-color: red;

	page-homepage {
			background-color: green;
//default values not depending on the platform
    .special {
        height: 200px


Ohh thanks, it worked. I didn’t included the selector while styling that’s why it wasn’t working.


Hi, I know it’s from long ago but my css is not working according to your reply. Every time the code is executing ios rather then md for android in my app which i couldn’t figure out why!