it should work globally, or sth is overriding the css.
Perhaps the default ionic CSS is overriding the customized CSS. In this case u can add your code or change the variables here in the theme\app.vaiables.scss as shown here.
your page’s independent scss file is overriding the global CSS.
Best to check out chrome’s debug panel to see what is overriding the css.
But it applies to allmodals of my project…
How can I specify the one that is for?
I have page1.html and page1.ts, calling mymodal.html.
Then i created mymodal.scss and put that code here, but not working.
edit: mymodal.html code:
<ion-buttons>
<button full (click)="dismiss(1)">
<ion-icon name="close"></ion-icon>
</button>
</ion-buttons>
I happened to completely revamp the css of some particular models.
It’s possible! and it wasnt that hard.
I am not sure why you only got an <ion-button> inside the mymodal.html.
But it sounds like we should always try to wrap everything in your content with a <ion-content> tag.
Give <ion-content> an ID or a Class, and that will do the trick.
long as u got something to wrap it up with an ID/Class will do the trick.
the reason i use an <ion-content> is that in case u need to fiddle with some functions like scrollTo() inside a model, it would eliminate unexpected errors. Also, some ionic default css only applied to elements inside <ion-content> so that’s to make sure things dont look weird, becuz perhaps u only want to change and override the color of a certain element but not to rewrite the whole css for it.
Ionic add different css classes to elements when u load it in different devices and sometimes it changes according to the window width. If you are not modding the model’s size then that should not be a matter, but in my case I hv to completely change the wrapper dimensions of the model and cater for different screen sizes, so giving it an ion-content makes it behave more consistently
Here’s what my model looks like, the very same model with different css treatment in different screens:
this will make everything, including the <ion-title> and <ion-button>, looks great in place.
Becuz ionic2 default css apply styles to <ion-title> and <ion-button> inside a <ion-toolbar>, they hv to put in such order to get it work.
well yes this can be done with some tricky ways.
you will realise that ionic add the element <ion-reorder> to the list which becomes the icon.
We cannot simply make it disappear by using css “display: none”, becuz in order to get the reordering function working we still need it there and replace it with a place holder to be dragged with.
Here’s what i will do, <ion-reorder> has a child called <ion-icon> which IS the icon itself.
Let’s override the color and make it transparent, so it looks like it’s gone:
What we hv done here, is that we make the icon invisible but the button is still there for u to drag around.
now then we still need to add sth back to it so we know it’s there.
We do this by giving the <ion-reorder> element a background-image.