我正在尝试将我网站上当前的CSS按钮设置为移动设备实际尺寸的2或3倍..我没有太多运气
the sytles
.all-news-btn {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #333333);
background-image: -moz-linear-gradient(top, #666666, #333333);
background-image: -ms-linear-gradient(top, #666666, #333333);
background-image: -o-linear-gradient(top, #666666, #333333);
background-image: linear-gradient(to bottom, #666666, #333333);
-webkit-border-radius: 3;
-moz-border-radius: 3;
border-radius: 3px;
font-family: Arial !important;
color: #ffffff !important;
font-size: 12px !important;
padding: 7px 8px 7px 7px;
text-decoration: none;
margin-left: 3px;
}
.all-news-btn:hover {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #000000);
background-image: -moz-linear-gradient(top, #666666, #000000);
background-image: -ms-linear-gradient(top, #666666, #000000);
background-image: -o-linear-gradient(top, #666666, #000000);
background-image: linear-gradient(to bottom, #666666, #000000);
text-decoration: none;
}
媒体查询
@media only screen and (max-device-width: 480px)
{
.all-news-btn {width: 100%; font-size: 4.25em;}
}
答案 0 :(得分:1)
.bt{
background: #333;
color: #fdfdfd;
min-height: 35px;
margin: 0;
border-radius: 3px;
border: 0;
line-height: 35px;
text-align: center;
margin: .5em 0 .5em 0;
}
a.bt{
display: inline;
padding: 7px 10px 7px 10px;
}
.bt:hover{
background: #000;
}
@media only screen and (max-width:480px) {
.bt {
width: 100%;
}
a.bt{
display: block;
padding: 0;
}
}

<button class="bt">Button example</button>
<a class="bt">A example</a>
<input class="bt" type="button" value="Input example"/>
&#13;
您可以通过在主按钮类中添加min-width
属性来轻松解决此问题。看看:
.all-news-btn {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #333333);
background-image: -moz-linear-gradient(top, #666666, #333333);
background-image: -ms-linear-gradient(top, #666666, #333333);
background-image: -o-linear-gradient(top, #666666, #333333);
background-image: linear-gradient(to bottom, #666666, #333333);
-webkit-border-radius: 3;
-moz-border-radius: 3;
border-radius: 3px;
font-family: Arial !important;
color: #ffffff !important;
font-size: 12px !important;
padding: 7px 8px 7px 7px;
text-decoration: none;
margin-left: 3px;
min-width: 100px;
min-height: 30px;
display: inline;
}
.all-news-btn:hover {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #000000);
background-image: -moz-linear-gradient(top, #666666, #000000);
background-image: -ms-linear-gradient(top, #666666, #000000);
background-image: -o-linear-gradient(top, #666666, #000000);
background-image: linear-gradient(to bottom, #666666, #000000);
text-decoration: none;
}
@media only screen and (max-width:480px) {
.all-news-btn {width: 100%; font-size: 4.25em; }
}
&#13;
<button class="all-news-btn">Button example</button>
<input class="all-news-btn" type="button" value="Input example"/>
&#13;