例如,不要在html页面中每次出现“*”之前使用字体标记和颜色属性,我只想使用一些代码行使它们变为红色。

<div class="col-md-1" align="right">Area * </div>
       <div class="col-md-4">
          <select class="form-control" id="area" name="area">
               <option>--Select--</option>
          </select>
       </div>
   </div>
    <br>
    <div class="row">
        <div class="col-md-2"><p id="desc_error" class="text-danger"></p></div>
        <label class="col-md-2">Description *</label>
        <div class="col-md-5">
            <textarea id="desc" class="form-control" name="desc" rows="10" cols="10s" style="resize: none"
          data-toggle="popover" data-trigger="focus" data-placement="right" data-content="To get more relevant responses provide additional details like prerequisites, qualification details and all other needs that you want."></textarea>
        </div>
    </div>
    <br>
    <div class="row">
        <div class="col-md-2"><p id="exp_error" class="text-danger"></p> </div>
        <label class="col-md-2">Job Expires in *</label>
    </div>

最佳答案

使用CSS时,我会采用以下方法:

<div><span>Area</span></div>


 div > span:after {
    content: "*";
    color: red;
 }

关于javascript - 如何更改html页面中每次出现的特定字符的颜色? (例如,用于“*”),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26147426/

10-12 00:51