html - 样式化表单中的提交按钮

标签 html css

我制作了一个简单的表单,但我无法让提交按钮采用自己的样式。 请告诉我为什么我不能单独设置提交按钮的样式,最好是如何只针对此按钮。

label{float:left;text-align:right;} 

input{width:44%;} 

textarea{width:99%;float:none;height:300px;} 

input{float:left;padding:20px;margin-bottom:20px;} 

textarea, input{border-radius:5px;border:thin groove #000;} 

textarea:focus, input:focus { 
    outline:none; 
    border: 1px solid #f00; 
    /* create a BIG glow */ 
    box-shadow: 0px 0px 14px #f00; 
    -moz-box-shadow: 0px 0px 14px #f00; 
    -webkit-box-shadow: 0px 0px 14px #f00; 
    border-radius:5px; 
}​ 

#thesubmit{padding:23px;background:#939;font-size:30px;border-radius:20px;} 

<form id="contact_form"> 
    <div> 
        <label for="name"></label> 
        <input type="text" name="Name" value="Enter Name" style="margin-right:20px;"/> 
    </div> 

    <div> 
        <label for="email"></label> 
        <input type="text" name="Email" value="Enter Email"/> 
    </div> 

    <div> 
        <label for="message"></label> 
        <textarea name="message" placeholder="Enter Message" id="message" rows="10" cols="50"></textarea> 
    </div> 

    <div class="button"> 
        <input type="submit" value="send now" id="thesubmit" />

最佳答案

你可以这样做:

.button input[type=submit]{ 
    background: #000;
    color: #fff;
}

DEMO HERE

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

相关文章:

css - 无序列表 : Limiting the number of List-items before starting a new column

php - 创建一个突出显示当前选项卡的 php 菜单

html - 将我的元素向右移动?

javascript - 根据属性更改选择选项

javascript - 在 onClick (HTML) 中打断线

html - 我可以/应该创建多大的 cookie?

angularjs - 共享同一行和列时将网格项设置为不重叠

javascript - 如何创建每行 3 个元素的水平网格

css - 如何创建像 youtube 那样的下拉菜单?

javascript - 如何制作下拉菜单以打开下拉菜单?