Css 关注最后一个孩子

Css 关注最后一个孩子,css,twitter-bootstrap-3,css-selectors,focus,Css,Twitter Bootstrap 3,Css Selectors,Focus,我正在使用验证器,它是在输入后添加的标记,我想更改span中的最后一个标记 <span class="input-icon"> <input type="text" id="name" name="name" class="form-control" data-fv-field="name"> <i class="form-control-feedba

我正在使用验证器,它是在输入后添加的标记,我想更改span中的最后一个标记

  <span class="input-icon">                                            
      <input type="text" id="name" name="name" class="form-control" data-fv-field="name">
      <i class="form-control-feedback" data-fv-icon-for="name" style="display: none;"></i>                                                    
      <i class="fa fa-globe blue circular"></i>                                                
  </span>

  .input-icon :last-child  {
      box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.1) inset;   
  }

我认为缺少了一些CSS代码来改进答案。但是,尽管缺少CSS代码,这应该可以工作:

i:last-child
使用此选项,您可以选择
标记的最后一个子项。现在,如果要更改CSS属性,请在CSS中:

i:last-child {
    background: #ff0000;
}

+
将以下一个直接同级元素为目标。如果要查找所有同级元素,请使用
~
而不是
+

   .input-icon > input:focus ~ .circular  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
    }

    .input-icon > input:focus .circular  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
    }

   .input-icon > input:focus :last-child  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
   }

   .input-icon > input:focus ~ [class*="fa-"], .input-icon > input:focus :last-child  {
   opacity: 1;
   }

   .input-icon > input:focus ~ .circular  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
    }

    .input-icon > input:focus .circular  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
    }

   .input-icon > input:focus :last-child  {
    box-shadow : 0 0 0 0.1em rgba(0, 0, 0, 0.25) inset !important;   
   }

   .input-icon > input:focus ~ [class*="fa-"], .input-icon > input:focus :last-child  {
   opacity: 1;
   }