ionic 4 how to change :shadow dom in css?

与世无争的帅哥 提交于 2019-12-12 15:04:05

问题


css problem with ion-select that has a button inside a shadow root. I need the default value --padding-top:10px,--padding-end:8px,--padding-bottom:10px,--padding-start:16px for this, but it is a first element and assumes the value applied as shown below.

below image contains color box which is ion-select and unable to control size of this box.code for ion-select is below. Can someone help me?

<ion-col size="2" style="padding:0">
            <div class="colorselect color_{{color.slice(1,7)}}">

                <ion-select >
                  <ion-select-option (ionSelect)="selectColor(optioncolor)" *ngFor="let optioncolor of colors" [value]="optioncolor" >{{optioncolor}}
                  </ion-select-option>
                </ion-select>
            </div>
          </ion-col>


回答1:


Try this one.Its works for me

ion-select{
    --padding-top:12px !important;
    --padding-end:12px !important;
    --padding-bottom:12px !important;
    --padding-start:20px !important;
}


来源:https://stackoverflow.com/questions/56076485/ionic-4-how-to-change-shadow-dom-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!