html - 无法设置表单提交按钮的样式

标签 html css forms

编辑:已解决,看评论!

我读过几篇关于在表单中设置提交按钮样式的帖子,但它似乎只部分适用于我。我可以更改边框,但不能更改背景颜色或字体设置。有人可以告诉我我的代码有什么问题吗?我是表格的新手,所以我可以只使用 n00bed。我试过背景、背景颜色、十六进制值……我只是被难住了。

#submitButton {
color: black;
background: #cac9c9;
border: 4px solid blue;

<form action="#" method="post">
    <input type="text" value="user@domain.com" />
    <div class="clear"></div>
    <hr />
    <div id="checkboxContainer">
        <span>Select the newsletters you'd like to receive</span>
        <input type="checkbox" name="travel" value="Getaways" />
        <label>Destinations &#38; Getaways</label>
        <br />
        <input type="checkbox" name="travel" value="Tips" />
        <label>Weekly Travel Tips</label>
    </div>
    <input id="submitButton" type="submit" value="SIGN UP" />
</form>

最佳答案

Click for demo

CSS

.classname {
    -moz-box-shadow:inset 0px 1px 0px 0px #bee2f9;
    -webkit-box-shadow:inset 0px 1px 0px 0px #bee2f9;
    box-shadow:inset 0px 1px 0px 0px #bee2f9;
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #63b8ee), color-stop(1, #468ccf) );
    background:-moz-linear-gradient( center top, #63b8ee 5%, #468ccf 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#63b8ee', endColorstr='#468ccf');
    background-color:#63b8ee;
    -webkit-border-top-left-radius:20px;
    -moz-border-radius-topleft:20px;
    border-top-left-radius:20px;
    -webkit-border-top-right-radius:20px;
    -moz-border-radius-topright:20px;
    border-top-right-radius:20px;
    -webkit-border-bottom-right-radius:20px;
    -moz-border-radius-bottomright:20px;
    border-bottom-right-radius:20px;
    -webkit-border-bottom-left-radius:20px;
    -moz-border-radius-bottomleft:20px;
    border-bottom-left-radius:20px;
    text-indent:0;
    border:1px solid #3866a3;
    display:inline-block;
    color:#14396a;
    font-family:Arial;
    font-size:15px;
    font-weight:bold;
    font-style:normal;
    height:50px;
    line-height:50px;
    width:86px;
    text-decoration:none;
    text-align:center;
    text-shadow:1px 1px 0px #7cacde;
}
.classname:hover {
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #468ccf), color-stop(1, #63b8ee) );
    background:-moz-linear-gradient( center top, #468ccf 5%, #63b8ee 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#468ccf', endColorstr='#63b8ee');
    background-color:#468ccf;
}.classname:active {
    position:relative;
    top:1px;
}

I forked your jsfiddle example and solution is here it works

关于html - 无法设置表单提交按钮的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23054445/

相关文章:

php - 从数组中选择多选表单

javascript - 以 Angular 向表格添加滚动条

javascript jquery datatables 未定义不是一个函数

html - 使用 Flexbox 重新定位选择器

javascript - 从上一个 span 元素获取样式

php - 服务器文件中删除了所有换行符

html - 段落元素的背景扩展以填充表格

asp.net - Listview 中的 ItemTemplate - 布局问题

html - <tr> 在显示 <tbody> 时被压缩 :block

php - 尝试使用 PHP 表单写入 MySQL 数据库