html - 指定输入类型名称?

标签 html css forms input

我正在制作联系表。现在显然我希望消息框比电子邮件和主题输入框大。所以很明显我不能只在 css 中输入我的输入,因为它会改变所有框。我以为指定消息框会像这样

input [type="text" name="message"] {
    padding-bottom: 500px;
}

那显然是行不通的...那么我做错了什么?

HTML

<div id="contactContent">
 <form>
 <label>Email:</label><input type="text" name="email" />
 <br>
 <label>Subject:</label><input type="text" name="subject" />
 <br>
 <label>Message:</label><input type="text" name="message" />
 </form>
</div>

CSS

#contactContent { 
    margin-top: 50px; 
    margin-left: 350px;
}
input { 
    border: none; 
    background-color: #CCCCCC; 
    margin-left: 20px; 
    margin-bottom: 5px; 
    padding-right: 250px;
    padding-top: 13px;
    padding-bottom: 13px;
}
label {
    display:inline-block;
    width:100px;
    font-family:maven;
    color: #FF6464;
    font-size: 20px;
    text-align: right;
}
input [type="text" name="message"] {
    padding-bottom: 500px;
}

最佳答案

您的选择器不正确,通过元素的类型和名称将样式应用到元素的正确方法是:

input[type="text"][name="message"] {
    padding-bottom: 500px;
}

尽管您最好使用类或 ID 来定位元素,除非您有充分的理由这样做。

关于html - 指定输入类型名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16611687/

相关文章:

javascript - 如何在 html 中突出显示突出显示文本副本的特定链接和自动?

javascript - 如何使用 JS/jQuery 正确提交动态创建的表单?

javascript - 如果确认为 false,则取消选择复选框

javascript - 使用 HTML 5 和 angularJs 只允许整数(并限制小数)的最快方法是什么

css - 无法在 Angular 2 中正确显示 Bootstrap Carousel

html - 视网膜显示屏上的 Chrome 文本阴影错误

html - 下拉菜单打破页脚

javascript - Polymer 1.0 无法访问嵌套 <template> 元素中的元素

html - 改变 Bootstrap 网格系统

javascript - 单击行按钮删除动态创建的表行