如何更改MD中输入组件的下划线颜色Bootstrap

How to change the underline color of the input component in MD Bootstrap

所以我正在使用 Input Group Component from MDBootstrap.

我想知道是否有办法改变 MD Bootstrap 中输入字段组件的空白颜色。就像现在,它看起来像这样(没有焦点):

当我点击这个输入字段时,它看起来像这样(有了焦点,输入字段空白的颜色变为绿色):

该组件的代码如下:

<div class="input-group input-group-lg">
  <div class="input-group-prepend">
    <span class="input-group-text" id="inputGroup-sizing-lg">Name</span>
  </div>
  <input type="text" class="form-control" aria-label="Large" aria-describedby="inputGroup-sizing-sm">
</div>

我想知道是否有办法在我们单击时将输入字段空白的颜色更改为黑色而不是绿色。谢谢!

设置 backgroundImage 样式 <input /> 会起作用

在文本中尝试:

const style = {
  backgroundImage: `linear-gradient(0deg, black 2px, rgba(0, 150, 136, 0) 0),
    linear-gradient(0deg, rgba(0, 0, 0, 0.26) 1px, transparent 0)`
};
const App = () => {
  return (
    <div className="App">
      <div class="input-group input-group-lg">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroup-sizing-lg">
            Large
          </span>
        </div>
        <input
          type="text"
          class="form-control"
          aria-label="Large"
          style={style}
          aria-describedby="inputGroup-sizing-sm"
        />
      </div>
    </div>
  );
};
ReactDOM.render(<App />, document.getElementById("root"));
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.12.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.12.0/umd/react-dom.production.min.js"></script>
<link
  rel="stylesheet"
  href="https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css"
  integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX"
  crossorigin="anonymous"
/>


实现步骤:

如果在浏览器中查看样式,

您会发现带有动画的颜色,复制它并更改该颜色,仅此而已。

您可以更改边框底部:

.md-form .form-control#form1 {
  border-bottom: 1px solid #f48fb1;
}