【发布时间】:2011-07-23 21:26:49
【问题描述】:
我在我的网站上使用 CSS 来设置输入按钮的样式,但在 IOS 设备上,样式被 Mac 的默认按钮所取代。有没有办法为 iOS 设置按钮样式,或者可以创建一个类似于提交按钮的超链接?
【问题讨论】:
我在我的网站上使用 CSS 来设置输入按钮的样式,但在 IOS 设备上,样式被 Mac 的默认按钮所取代。有没有办法为 iOS 设置按钮样式,或者可以创建一个类似于提交按钮的超链接?
【问题讨论】:
【讨论】:
@include experimental(appearance, none);
<select> 框在桌面浏览器上时不显示箭头。所以我认为这最好与媒体查询搭配使用。
CSS 线条来设置它的样式,这条线就足够了?!
请添加此 CSS 代码
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
【讨论】:
我最近自己也遇到过这个问题。
<!--Instead of using input-->
<input type="submit"/>
<!--Use button-->
<button type="submit">
<!--You can then attach your custom CSS to the button-->
希望对您有所帮助。
【讨论】:
使用下面的css
input[type="submit"] {
font-size: 20px;
background: pink;
border: none;
padding: 10px 20px;
}
.flat-btn {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border-radius: 0;
}
h2 {
margin: 25px 0 10px;
font-size: 20px;
}
<h2>iOS Styled Button!</h2>
<input type="submit" value="iOS Styled Button!" />
<h2>No More Style! Button!</h2>
<input class="flat-btn" type="submit" value="No More Style! Button!" />
【讨论】:
我今天在使用 primefaces (primeng) 和 angular 7 时遇到了同样的问题。 将以下内容添加到您的 style.css
p-button {
-webkit-appearance: none !important;
}
我还使用了一些 bootstrap,它有一个 reboot.css,它会覆盖它(这就是为什么我必须添加!important)
button {
-webkit-appearance: button;
}
【讨论】:
-webkit-外观:无;
注意:使用 bootstrap 设置按钮样式。它通常用于响应式。
【讨论】: