【问题标题】:Editing Buttons in HTML, CSS在 HTML、CSS 中编辑按钮
【发布时间】:2012-02-15 22:39:49
【问题描述】:

在 HTML 或 CSS 中,有没有办法编辑按钮的大小、形状和整体外观,比如代码

<input type="button" onclick="spam()" value="Spam">

但要让按钮看起来很吸引人,而不是灰色和小?

【问题讨论】:

  • 谷歌“使用 CSS 设置表单元素样式”可以获得数十个(甚至数百个)示例和教程。
  • 只需谷歌“使用 css 的样式按钮”

标签: html css button


【解决方案1】:

当然,一种方法是给它一个类并使用该类来设置它的样式。

<input class="submit-button" type="button" onclick="spam()" value="Spam">

.submit-button{  
  /* style properties go here */
}

要将所有按钮的样式设置为相同,您可以简单地使用 CSS 选择器,如下所示

input[type="button"] {
    /* style properties go here */
}

【讨论】:

    【解决方案2】:

    在 CSS 中:

    input[type="button"] {
        // your CSS
    }
    

    或删除[type="button"] 以应用于所有输入...

    【讨论】:

      【解决方案3】:

      当然。只需给你的按钮上一堂课,然后去镇上做造型。

      Try this.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-10-31
        • 2022-12-22
        • 1970-01-01
        • 1970-01-01
        • 2023-03-26
        • 1970-01-01
        • 1970-01-01
        • 2018-12-25
        相关资源
        最近更新 更多