Html 如何使用type=";“颜色”;在<;按钮>;标签

Html 如何使用type=";“颜色”;在<;按钮>;标签,html,button,colors,twitter-bootstrap-4,Html,Button,Colors,Twitter Bootstrap 4,我需要使用带有颜色选择器的按钮标签,但我不能使用输入,因为该值不能是google材质图标 我能做什么 <button type="color" value="#ff0000" type="button" class="btn btn-secondary herramienta"><i class="material-icons">format_color_text</i></button> format\u color\u text 您可能会有一

我需要使用带有颜色选择器的按钮标签,但我不能使用输入,因为该值不能是google材质图标 我能做什么

<button type="color" value="#ff0000" type="button" class="btn btn-secondary herramienta"><i class="material-icons">format_color_text</i></button>
format\u color\u text

您可能会有一个不透明度设置为0的输入,将其放在按钮顶部,然后当他们点击按钮时,他们实际上会点击输入,类似于:

<div style="position:relative; display:inline-block">
    <button type="button" class="btn btn-secondary herramienta"><i class="material-icons">format_color_text</i></button>
    <input type="color" value="#ff0000" style="opacity:0; position:absolute; left:0;top:0;width:100%"/>
</div>

格式化\u颜色\u文本

您可能会有一个不透明度设置为0的输入,将其放在按钮顶部,然后当他们点击按钮时,他们实际上会点击输入,类似于:

<div style="position:relative; display:inline-block">
    <button type="button" class="btn btn-secondary herramienta"><i class="material-icons">format_color_text</i></button>
    <input type="color" value="#ff0000" style="opacity:0; position:absolute; left:0;top:0;width:100%"/>
</div>

格式化\u颜色\u文本