如何删除一个元素的.has-error输入样式?

时间:2015-02-13 12:33:11

标签: css twitter-bootstrap twitter-bootstrap-3

如何使用id设置最后一个输入的样式 #event_fb_website {...}所以它的风格像常规输入没有错误?

<div class="form-group has-error">
    <div class="field_with_errors"><label class="col-sm-2 control-label" for="event_website">Website URL</label></div>
    <div class="col-sm-10">
      <div class="field_with_errors"><input placeholder="http://..." class="form-control" type="url" value="" name="event[website]" id="event_website"></div>
        <span class="help-block">
          Website can't be blank
        </span>
      <input placeholder="http://..." class="form-control" type="url" value="" name="event[website]" id="event_fb_website">
    </div>
  </div>

2 个答案:

答案 0 :(得分:0)

只需将输入设置为默认状态

#event_fb_website {
    border: 1px solid #ccc;
}

#event_fb_website:focus {
    border-color: rgba(82,168,236,.8);
    box-shadow: 0 0 8px rgba(82,168,236,.6);
 }

答案 1 :(得分:0)

不知道为什么有人拒绝这个问题,无论如何回答是:

#event_logo_url {
    border: 1px solid #ccc;
}
#event_logo_url:focus {
  border-color: #66afe9;
  outline: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
          box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
}

可能是这样的:

#event_logo_url::-moz-placeholder {
  color: #999;
  opacity: 1;
}
#event_logo_url:-ms-input-placeholder {
  color: #999;
}
#event_logo_url::-webkit-input-placeholder {
  color: #999;
}