Input type color styling

后端 未结 4 1985
梦谈多话
梦谈多话 2021-02-14 06:33

I have a small question, since I\'m not too good at CSS i want to know if there any way I can recreate such a nice input[type=color] element\'s style? I mean not everything on t

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-14 06:49

    Note: for Firefox you would need to use -moz-color-swatch There is no color-swatch-wrapper equivalent on Firefox.

    You need to create a new rule, since it's not possible mix vendors prefixed rules (see Why isn't it possible to combine vendor-specific pseudo-elements/classes into one rule set? )

    i.e. add

    #primary_color::-moz-color-swatch {
        border: none;
        border-radius: 100%;
    }
    

    For Firefox to look like what you expect, seems you also need to add padding: 0px; on the #primary_color section

提交回复
热议问题