whats the correct way of inserting label in an Ionic FAB list

后端 未结 6 732
谎友^
谎友^ 2020-12-08 10:56

i want to insert a label so that matches every FAB icon on the Fab list whats the correct way of doing it. the way i did it it doesn\'t work

6条回答
  •  猫巷女王i
    2020-12-08 11:25

    ross solution is great,but in order for it to work on Ionic v2 I had to change the .fab class that comes with Ionic from contain: strict to contain: layout.

    This is how the class is originally:

    .fab {
        -moz-appearance: none;
        -ms-appearance: none;
        -webkit-appearance: none;
        appearance: none;
        position: relative;
        z-index: 0;
        display: block;
        overflow: hidden;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        font-size: 14px;
        line-height: 56px;
        text-align: center;
        text-overflow: ellipsis;
        text-transform: none;
        white-space: nowrap;
        cursor: pointer;
        transition: background-color, opacity 100ms linear;
        background-clip: padding-box;
        -webkit-font-kerning: none;
        font-kerning: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        contain: strict;
    }
    

    So, add the following on your page .scss file:

    .fab {
        contain: layout;
    }
    

    It will overwrite the default .fab class for the page and it will work.

提交回复
热议问题