CSS div按钮无法在Iphone或Ipad上运行

时间:2013-03-07 20:00:08

标签: iphone css ipad button media-queries

我正在为我的学校开发一个基于CSS的手机,平板电脑和桌面版本的网络应用程序。我正在使用媒体查询。该应用程序几乎完成,它几乎可以在所有浏览器和Android上正常工作。该应用程序在Iphone / Ipad上看起来很棒但是按钮不起作用使得这些设备中的应用程序无用。

这就是我所拥有的:

//Source code

<div id="signinbutton" class="blue_button">Sign In</div>

//desktop.CSS

.blue_button {
    width: 130px;
    height: auto;
    padding: 8px;
    margin: 0% auto 20% auto;
    background-image:url(../../images/bluebar5.png);
    color: #FFF;
    text-align: center;
    font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
    font-size: 14pt;
    font-weight: bolder;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    cursor: default;
    }
.blue_button:hover {
    opacity: 0.7;
}

//Handheld.css (this overwrites css on desktop)

.blue_button {
    width: 260px;
    font-size: 18pt;
    background-image:url(../../images/bluebar6.png);
}

我尝试将这种风格应用于#signinbutton但没有成功。

3 个答案:

答案 0 :(得分:5)

您应该使用<button><input type="button">标记而不是div。虽然<div>按钮功能可能在某些浏览器中有效,但与传统按钮标签相比,它可能有点像黑客

答案 1 :(得分:0)

你可以像这样包裹你的div <a>。它现在完全适用于html5。

<a href="#"><div id="signinbutton" class="blue_button">Sign In</div></a>

你只需要调整 参考: here's Google's blog post

答案 2 :(得分:-1)

尝试添加try: already_exist_info = UserDetail.objects.get( document_type=document_type, series=int(series), number=number, ) raise forms.ValidationError("Document already exists in DB") except UserDetail.DoesNotExist: pass return cleaned_data

的样式