Html 如何在html中的按钮中设置文本大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18310434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:18:52  来源:igfitidea点击:

How to set text size in a button in html

htmlbuttontextsize

提问by Pancake_Senpai

Hello I want to have a button on my website and I want to resize the text on my button. How do I do this?

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

My code is below:

我的代码如下:

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

回答by Devang Rathod

Try this

尝试这个

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

回答by Pandiyan Cool

Try this, its working in FF

试试这个,它在 FF 中工作

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

回答by Devsi Odedra

Belated. If need any fancy button than anyone can try this.

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

#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;
  }
<div id="startStopBtn" onclick="startStop()" class=""> Go!</div>

回答by Hless

Without using inline CSS you could set the text size of all your buttons using:

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

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