<form action="http://****.com/message/?fepaction=checkmessage" method="post" enctype="multipart/form-data">
To: <br><input type="text" name="message_to" placeholder="Username of recipient" autocomplete="off" value=""><br>Subject:<br>
<input type="text" name="message_title" placeholder="Subject" maxlength="65" value=""><br>Message:<br><div id="wp-message_content-wrap" class="wp-core-ui wp-editor-wrap tmce-active">
.....
</form>
我想隐藏
To: <br><input type="text" name="message_to" placeholder="Username of recipient" autocomplete="off" value="">
使用css
我目前的CSS是
#fep-content input[type=text] {
width: 45%;
min-width: 250px;
}
如果我添加
input[type="text"] {
display: none;
}
然后两个字段都是隐藏的。 我只想隐藏1个字段和单词&#34; To&#34;
怎么做?
答案 0 :(得分:1)
<form action="http://****.com/message/?fepaction=checkmessage" method="post" enctype="multipart/form-data">
<div id="something">
To: <br><input type="text" name="message_to" placeholder="Username of recipient" autocomplete="off" value=""></div><br>Subject:<br>
<input type="text" name="message_title" placeholder="Subject" maxlength="65" value=""><br>Message:<br><div id="wp-message_content-wrap" class="wp-core-ui wp-editor-wrap tmce-active">
.....
</form>
添加
#something {
display: none;
}
答案 1 :(得分:1)
您可以使用Attribute selector
input[name="message_to"] {
display: none;
}
<form action="http://****.com/message/?fepaction=checkmessage" method="post" enctype="multipart/form-data">
To: <br><input type="text" name="message_to" placeholder="Username of recipient" autocomplete="off" value=""><br>Subject:<br>
<input type="text" name="message_title" placeholder="Subject" maxlength="65" value=""><br>Message:<br><div id="wp-message_content-wrap" class="wp-core-ui wp-editor-wrap tmce-active"></div>
</form>
答案 2 :(得分:0)
答案 3 :(得分:0)
您可以通过多种方式隐藏第一个输入(name=message_to
)。要隐藏To
,您可以使用:first-line
然后将width
和overflow:hidden
提供给form
,而不会将To
包裹在元素中。
/* input[name="message_to"] */
/* input:first-child */
/* input:nth-child(1) */
/* input:nth-of-type(1) */
input:first-of-type,
br:first-of-type{
display: none;
}
form {
width: 100%;
overflow: hidden;
}
form:first-line {
font-size: 0;
line-height: 0;
}
&#13;
<form action="http://****.com/message/?fepaction=checkmessage" method="post" enctype="multipart/form-data">
To:
<br>
<input type="text" name="message_to" placeholder="Username of recipient" autocomplete="off" value="">
<br>Subject:
<br>
<input type="text" name="message_title" placeholder="Subject" maxlength="65" value="">
<br>Message:
<br>
<div id="wp-message_content-wrap" class="wp-core-ui wp-editor-wrap tmce-active"></div>
</form>
&#13;