【问题标题】:How to set text size in a button in html如何在html中的按钮中设置文本大小
【发布时间】:2013-08-21 01:13:41
【问题描述】:

您好,我想在我的网站上有一个按钮,并且我想调整按钮上的文本大小。我该怎么做?

我的代码如下:

<input type="submit" value="HOME" onclick="goHome()" style="width: 100%; height: 100px;"/> 

【问题讨论】:

标签: html button text size


【解决方案1】:

试试这个

<input type="submit" 
       value="HOME" 
       onclick="goHome()" 
       style="font-size : 20px; width: 100%; height: 100px;" /> 

【讨论】:

  • @user2627595 没关系,您也可以为它定义类而不是内联样式。
【解决方案2】:

试试这个,它在 FF 中工作

body,
input,
select,
button {
 font-family: Arial,Helvetica,sans-serif;
 font-size: 14px;
}

【讨论】:

    【解决方案3】:

    迟到了。如果需要任何花哨的按钮,任何人都可以试试这个。

    #startStopBtn {
        font-size: 30px;
        font-weight: bold;
        display: inline-block;
        margin: 0 auto;
        color: #dcfbb4;
        background-color: green;
        border: 0.4em solid #d4f7da;
        border-radius: 50%;
        transition: all 0.3s;
        box-sizing: border-box;
        width: 4em;
        height: 4em;
        line-height: 3em;
        cursor: pointer;
        box-shadow: 0 0 0 rgba(0,0,0,0.1), inset 0 0 0 rgba(0,0,0,0.1);
        text-align: center;
    }
    #startStopBtn:hover{
        box-shadow: 0 0 2em rgba(0,0,0,0.1), inset 0 0 1em rgba(0,0,0,0.1);
        background-color: #29a074;
      }
    &lt;div id="startStopBtn" onclick="startStop()" class=""&gt; Go!&lt;/div&gt;

    【讨论】:

      【解决方案4】:

      不使用内联 CSS,您可以使用以下方法设置所有按钮的文本大小:

      input[type="submit"], input[type="button"] {
        font-size: 14px;
      }
      

      【讨论】:

        猜你喜欢
        • 2014-09-20
        • 2022-08-06
        • 1970-01-01
        • 1970-01-01
        • 2011-12-06
        • 2011-02-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多