为什么我的移动网站上的按钮不成比例?

时间:2014-05-21 02:04:30

标签: css css3 mobile

我的移动网站上的按钮与屏幕完全不成比例。我无法弄清楚为什么它们如此之小。下面是一张图片。

以下是所有相关的CSS:

    <style type="text/css" media="handheld, only screen and (max-device-width: 700px)">
        #onbutton {
            -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
            -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
            box-shadow:inset 0px 1px 0px 0px #ffffff;
            background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
            background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
            background-color:#ededed;
            border-radius: 6px;
            text-indent:0;
            border:1px solid #dcdcdc;
            width: 100%;
            color:#777777;
            font-family:arial;
            font-size:15px;
            font-weight:bold;
            font-style:normal;
            height:50px;
            line-height:50px;
            text-decoration:none;
            text-align:center;
            text-shadow:1px 1px 0px #ffffff;
        }
        #onbutton:hover {
            background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );
            background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
            background-color:#dfdfdf;
        }
        #onbutton:active {
            position:relative;
            top:1px;
            background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #b9b9b9), color-stop(1, #cecece) );
        }

        #status {
            width: 100%;
            opacity: 0;
            text-align: center;
            font-family: sans-serif;
            border-width: 1px;
            border-style: solid;
            border-radius: 6px;
            padding-top: 10px;
            padding-bottom: 10px;
        }

        #status.off {
            background-color: #ff5353;
            border-color: #ff1515;
        }

        #status.on {
            background-color: #9eda97;
            border-color: #11ab0c;
        }
    </style>

这是HTML:

<body>
    <div id="main">
        <input type="button" value="Start computer" id="onbutton"></input>
        <br/>
        <br/>
        <div id="status" class="on" style="opacity:1">Hello</div>
    </div>
</body>

Image

1 个答案:

答案 0 :(得分:1)

您在寻找mobile meta viewport代码吗?

<meta name="viewport" content="width=device-width,initial-scale=1.0" />