html - 如何使用输入设置按钮样式
问题描述
我正在尝试将按钮文本对齐到中心,但它没有向上移动。它位于稍下方。我希望它与输入类型颜色一起放置在中心。
button{
outline: none;
background: #cccccc;
border: none;
border: 2px solid #efefef;
padding: .6rem 1rem;
margin-left: 1rem;
border-radius: 3px;
font-weight: 600;
}
input[type="color"] {
-webkit-appearance: none;
border: none;
border-radius: 50%;
width: 20px;
height: 20px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 50%;
}
<button class="strokecolor">Choose a color
<input type="color" value='#1a1a1a'>
</button>
<!--Choose a color text is not getting to the center of the button
解决方案
button{
display:flex;
align-items:center;
outline: none;
background: #cccccc;
border: none;
border: 2px solid #efefef;
padding: .6rem 1rem;
margin-left: 1rem;
border-radius: 3px;
font-weight: 600;
}
input[type="color"] {
-webkit-appearance: none;
border: none;
border-radius: 50%;
width: 20px;
height: 20px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 50%;
}
<button class="strokecolor">Choose a color
<input type="color" value='#1a1a1a'>
</button>
<!--Choose a color text is not geeting to the center of the button
推荐阅读
- dolphindb - 如何清除dolphindb中过期的流表数据
- azure-devops - 构建失败的 Azure Devops 管道能否在使用 CI 触发时向用户显示最后一次提交?
- android - 如何在移动设备上获取栏之间的视口高度?(反应)
- javascript - 如何在 npm 模型的反应代码中访问 Makehuman.js
- jenkins - 如何配置为使用给定访问令牌的 GitLab 组自动填充 Jenkins 选择参数
- c# - 如何在一行上显示一个字符串x次C#
- android - Compose BasicTextField 的问题:
- python-3.x - asyncio.create_task 创建的任务的容器
- android - 当我调用 api 时,Retrofit2 返回 999
- reactjs - 如何在我的 react.js 程序中添加自动递减时区?