我想在下面的表单代码中将“*”的颜色更改为红色,以便它们更加突出。到目前为止,我还没有找到一种简单的方法来做到这一点。 ,自定义标签在表单中不起作用。
<form name="requestForm" action="requestSent.cshtml" onsubmit="return validateRequest()" method="post">
<label>Email Address: *</label><br>
<input type="text" name="customerEmail" /><br><br>
<label>First Name: *</label><br>
<input type="text" name="firstName" /><br>
<label>Last Name: </label><br>
<input type="text" name="lastName" /><br><br>
<label>Phone Number: </label><br>
<input type="text" name="phoneNumber" /><br><br>
<label>Request: *</label><br>
<textarea name="customerRequest" cols="40" rows="4"></textarea>
<p><input type="submit" value="Submit" /></p>
<br>
* Required Fields
最佳答案
为所有 *
设置一个跨度。
<label>Email Address: <span class="red">*</span></label><br>
然后在你的 CSS 中:
<style type="text/css">
.red{
color: red;
}
</style>
关于javascript - 选择性表格文本颜色更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13005594/