简体   繁体   English

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

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

So I'm using the Input Group Component from MDBootstrap.所以我正在使用MBootstrap输入组组件

I was wondering if there's a way around for changing the color of the blank of the input field component in MD Bootstrap.我想知道是否有办法更改 MD Bootstrap 中输入字段组件的空白颜色。 Like at the moment, it looks like this (without focus):就像此刻,它看起来像这样(没有焦点):

没有焦点的输入字段组件

When I click on this input field, it looks like this (with focus, the color of the input field blank changes to green):当我点击这个输入字段时,它看起来像这样(有焦点,输入字段空白的颜色变为绿色):

具有焦点的输入字段组件

The code for the this component is as follows:该组件的代码如下:

<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>

I was wondering if there's a way around for changing the color of the input field blank to black instead of green when we click on it.我想知道是否有办法在我们点击它时将输入字段的颜色更改为黑色而不是绿色。 Thanks!谢谢!

Set backgroundImage style with <input /> would work使用<input />设置backgroundImage样式会起作用

Try it in-text:在文本中尝试:

 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" />


The step to achieve it:实现它的步骤:

If you check the style in the browser,如果您在浏览器中检查样式,

You would find that color with animation, copy it and change that color, and that's it.你会用动画找到那个颜色,复制它并改变那个颜色,就是这样。

在此处输入图片说明

You can change the border bottom:您可以更改边框底部:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何更改 MUI 输入下划线颜色? - How to change MUI input underline color? 如何使用Materialise w / Ruby on Rails在输入中更改预定的下划线颜色 - How to change a predeterminate underline color in an Input with Materialize w/Ruby on Rails 如何更改日文和中文构图输入文本的下划线颜色 - How to change color of underline of Japanese and Chinese composition input text Material-UI Input 组件下划线颜色 - Material-UI Input component underline color 如何更改下划线的拼写检查颜色 - How to change the spellcheck color of the underline 如何在 MD Bootsrap React 中更改按钮组件的字体和边框颜色 - How to change the font and border color of the Button Component in MD Bootsrap React 焦点时如何更改md-input-container占位符的颜色? - how to change the color of md-input-container placeholder when focus? 如何在悬停中删除背景颜色并将其更改为下划线,但是在Bootstrap中文本和行之间有空格? - How to remove background color in hover and change it to underline but with space between text and line in Bootstrap? 如何在JavaFX中更改TreeItem的下划线颜色? - How to change TreeItem's underline color in JavaFX? 导航栏 - 如何为活动链接添加下划线或更改颜色? - Navbar - how to underline or change color active link?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM