html - 如何在 css 中制作不同的按钮?

标签 html css

所以现在我有一个按钮,这就是那个按钮现在的样子:

input[type=button] {
    background: blue;
    width: 10%;
    font-size: 25px;
    font-weight: bold;
    margin: 0.5%;
}

现在假设我还想要三个按钮。它们看起来都一样,除了我的蓝色按钮,一个是红色的,另一个是黄色的,第四个按钮是绿色的。我该如何着手在 CSS 中创建这些新按钮?

最佳答案

input[type=button] {
    width: 10%;
    font-size: 25px;
    font-weight: bold;
    margin: 0.5%;
}
.red{
  background-color: red;
}
.blue{
  background-color: blue;
}
.yellow{
  background-color: yellow;
}
<input type="button" class="red"/>

<input type="button" class="blue"/>

<input type="button" class="yellow"/>

尝试使用

关于html - 如何在 css 中制作不同的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46841540/

相关文章:

html - 使表格行跨越整个宽度

html - DIV 中可调整大小的背景图像,其中包含位置相关元素

html - 防止 HTML 表格调整大小以适应内容

java - 从具有属性的 JSoup <a> 标记中提取链接

html - 将两个 div 放在彼此下方时不需要的滚动条

css - 使用 CSS 裁剪 DIV 的溢出

javascript - 在滚动条上设置 div 高度(IE 中的橡皮筋效果)

python - 有人知道如何使用 selenium webdriver 识别 shadow dom web 元素吗?

javascript - 从头开始构建的 super 菜单 - Jquery 调整大小

javascript - 如何使联系人的电话号码可点击以调用和发送 ionic 消息?