- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个表单,当我在表单内单击时,我想在其中设置具有特定背景颜色的输入字段的样式。但是,我对此有点麻烦。这是我所拥有的:
<form name="" action="/communicate/#wpcf7-f11-o1" method="post" class="wpcf7-form" novalidate="novalidate">
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="11" /><br />
<input type="hidden" name="_wpcf7_version" value="4.0" /><br />
<input type="hidden" name="_wpcf7_locale" value="" /><br />
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f11-o1" /><br />
<input type="hidden" name="_wpnonce" value="d6b53e1ecd" />
</div>
<p style="color: #fff;">Your Name (required)<br />
<span class="wpcf7-form-control-wrap your-name"><input type="text" name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Your Email (required)<br />
<span class="wpcf7-form-control-wrap your-email"><input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Subject<br />
<span class="wpcf7-form-control-wrap your-subject"><input type="text" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Your Message<br />
<span class="wpcf7-form-control-wrap your-message"><textarea name="your-message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea" aria-invalid="false"></textarea></span>
</p>
<p><input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit" /></p>
<div class="wpcf7-response-output wpcf7-display-none"></div>
</form>
我想在选择时将输入字段设置为黑色。还有一种我想要的叠加样式,但我稍后会处理。有人能帮忙吗?我没有编写 CSS 规则的奢侈,因为我正在从某人古怪的 WordPress 网站上拼凑一个损坏的表单。更改不会在 <span>
中完成吗?标签?我将字段名称设置为内联 #fff
, 并希望使用 #000
进行输入.谢谢!
最佳答案
您可以将其添加到您的 CSS 中:
input:focus, textarea:focus {
background: black;
color: white;
}
更新:
您可以在 <input>
中添加以下代码标签和 <textarea>
标签:
onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'"
像这样:
<input type="text" onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false">
<form name="" action="/communicate/#wpcf7-f11-o1" method="post" class="wpcf7-form" novalidate="novalidate">
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="11" /><br />
<input type="hidden" name="_wpcf7_version" value="4.0" /><br />
<input type="hidden" name="_wpcf7_locale" value="" /><br />
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f11-o1" /><br />
<input type="hidden" name="_wpnonce" value="d6b53e1ecd" />
</div>
<p style="color: #fff;">Your Name (required)<br />
<span class="wpcf7-form-control-wrap your-name"><input onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'" type="text" name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Your Email (required)<br />
<span class="wpcf7-form-control-wrap your-email"><input onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'" type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Subject<br />
<span class="wpcf7-form-control-wrap your-subject"><input onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'" type="text" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" /></span>
</p>
<p style="color: #fff;">Your Message<br />
<span class="wpcf7-form-control-wrap your-message"><textarea onclick="this.style.backgroundColor='black';this.style.color='white'" onblur="this.style.backgroundColor='white';this.style.color='black'" name="your-message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea" aria-invalid="false"></textarea></span>
</p>
<p><input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit" /></p>
<div class="wpcf7-response-output wpcf7-display-none"></div>
</form>
关于javascript - 如何使用内联背景颜色样式设置表单输入字段的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26433124/
我之前已经发布了一些这样的代码,试图在正确的位置获得侧边栏链接并以一种特殊的方式看起来,我决定朝着不同的方向前进。我现在需要的是知道我应该做什么来获得我在侧边栏旁边而不是下方标记为“内容”的 div。
我试图让多个 inline 和 inline-block 组件在 div 中垂直对齐。这个例子中的span怎么就非要往下推呢?我已经尝试了 vertical-align:middle; 和 verti
我试图让多个 inline 和 inline-block 组件在 div 中垂直对齐。这个例子中的span怎么就非要往下推呢?我已经尝试了 vertical-align:middle; 和 verti
我试图让多个 inline 和 inline-block 组件在 div 中垂直对齐。这个例子中的span怎么就非要往下推呢?我已经尝试了 vertical-align:middle; 和 verti
我很困惑...所以我在容器中有一个 UL,当我更改 UL 上方的 DIV 时,它似乎会影响 UL 之后的流程...发生了什么事? DIV 是 block 元素,对吗?和 UL 一样,对吧? 所以在这个
我问这个基本问题是为了澄清事实。都提到了这个问题及其目前接受的答案,这是不令人信服的。然而,投票第二多的答案提供了更好的洞察力,但也不是完美的。。在阅读下面的内容时,请尝试区分内联关键字和“内联”概念
function roll_over(img_name, img_src) { document[img_name].src = img_src; } 我使用此代码来显示 T 恤并在鼠标悬停时显
是否可以在 AngularJS 表达式的内联 if 语句中包含多个语句?例如,以下失败: ng-change="someCondition() ? doA(); doB() : doC()" ng-c
我在 RStudio 中使用 R Markdown 创建一个混合 Markdown 和 R 输出的报告。我知道如何在 Markdown 中使用内联 R 表达式,但我想知道如何进行相反的操作,即在 R
我们无法将表单标签添加到内联 CKEditor来自 chrome 和 IE,但它在 Firefox 中运行良好。如果我们将表单添加到内联 CKEditor,它会删除表单标签。 例如:如果我在 Fire
在我的 HTML 代码中,我有两个输入: Yes No 现在我有一个默认情况下的 div,因为它的样式显示内联,我希望当我单击“否”时,它会使其样式不显示,而"is"则会使其内联,所以我制作了此功
如何在 PowerShell 中创建带有内联 If 的语句(IIf,另请参阅: Immediate if 或 ternary If )? 如果您也认为这应该是 native PowerShell 函数
嗨。我在阅读以下问题后提出这个问题:Question_1和 Question_2 。 Question_1 没有任何合适的答案,Question_2 有替代解决方案,但不是完美的解决方案。 这里我有两
有人可以帮我解决以下语法或告诉我是否可行吗?因为我要修改 if ... else ... 条件。我不想在列表中添加重复的值,但我收到了 KeyError。 其实我不太熟悉这种说法: twins[val
有时我喜欢滥用 python 语法,特别是短的 if block : if True : print 'Hello' else : print 'Bye' 现在我尝试对函数定义做同样的事情: i
我在尝试将 Logo 容器底部对齐到零高度父级时遇到了问题。最好,我想用纯 CSS 来实现这一点。 在附带的 fiddle 中,我想让 control-group 的底部与零高度 panel 元素的顶
我需要内联编写 HTML 和 Javascript 代码,即在 HTML 正文中(需要显示一些随机整数值)我搜索了很多博客,但到目前为止没有找到任何帮助。请指教。 我想实现这个功能: Offer
好吧,这更多的是要求澄清 C++ 的一个特性是如何工作的,而不是一个是否可以的答案。我将从解释我遇到的问题开始,因为直接的答案是它不是一个很好的类设计。 我有一个类正在形成一个无法维护的 if 语句
我正在我的 C# 代码中获取一个数据库行。行包含 3 个不同的标志(3 列具有 true 或 false 值)。这些列中只有一列为真,这将决定该对象的类型。我如何在一行代码中确定该对象的类型。如果所有
在 CSS 中,我如何才能只将电话号码加粗,以便它与声明的其余部分内联,但电话号码是加粗的? 而不是在 HTML 中这样做: › Start posting jobs today– 0
我是一名优秀的程序员,十分优秀!