渲染按钮大小很小

时间:2015-12-26 02:18:30

标签: javascript jquery

在下面的代码中,

<head>
        <title>Intro</title>
        <meta charset="UTF-8">
        <script type="text/javascript" src="../js/jquery-1.11.3.js">
        </script>
        <script type="text/javascript">
            jQuery(document).ready(function(){
                jQuery('#button1').click(function(){
                    alert('Button clicked');
                });
            });
        </script>
    </head>
    <body>
        <button type="button" id="button1" value="Click Me"></button>
    </body>

button1尺寸在渲染时看起来很小。

firefox 45 chrome 47 渲染小尺寸按钮。

如何解决此错误?

注意:window.jQuery已创建

2 个答案:

答案 0 :(得分:3)

该按钮为空,将要显示的文本放在按钮标签内的按钮上

<button type="button" id="button1">Click Me</button>

答案 1 :(得分:0)

首先,设置按钮的文字:

<button type="button" id="button1">Click Me</button>

如果此处的自动尺寸不够,请设置显式css,例如:

#button1{
  width: 40px;
  height: 20px;
}