Search code examples
ionic4css-variables

How to change the default global value of left padding in ionic 4?


I want to change the default value of global left ion-padding.

Adding --ion-padding-start: 20px in variable.scss under :root selector is not working. I don't want to explicit mention the left padding to the components, as doing this applies the left padding. I want to set the value for global left padding.


Solution

  • --ion-padding-start will not work if we want to change the default value of padding. I added these lines of code in global.scss file :

    .ion-padding,
      [padding] {
        padding-top: 20px;
        padding-bottom: 20px;
        padding-left: 60px;
        padding-right: 60px;
      }
    

    In this way we can change the default value of global left padding in ionic project.