【问题标题】:why Bootstrap 4 Form password field font has a unexpected underline?为什么 Bootstrap 4 Form 密码字段字体有意外的下划线?
【发布时间】:2018-12-03 12:30:55
【问题描述】:

密码字段字体中出现意外的下划线 这个表单在 bootstrap 4 modal

<form method="post">
    <div class="form-group">
        <label for="username"><u>Username:</u></label>
        <input type="text" class="form-control" id="username" name="username" 
        autocomplete="off" autofocus required>
    </div>
    <div class="form-group"> 
         <label for="password"><u>Password:<u></label>
         <input type="password" class="form-control" id="password" 
         name="password" autocomplete="off" required>
         <a href="#">Forgot password?</a>
    </div>

    <div class="form-check">
        <label class="form-check-label" for="check">
             <input type="checkbox" class="form-check-input" id="check">Remember me
        </label>
    </div>
    <center>
         <button type="submit" name="login-btn" class="btn btn-success">Login</button>
    </center>
</form>

HTML 代码

.form-control,.form-control:focus{
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid white;
    border-radius: 0;
    color: white;
    background: none;
    outline: none;
    box-shadow: none;
    padding: 0;
}

.form-check{
    margin-top: 50px;
}

.form-check-input{
    margin-top: .4rem;
    width: 15px;
    height: 15px;
}

CSS 我应用了 我也试过 text-decoration:none; 大部分情况下我可以说这是 不是边框。输入字段边框是白色的

【问题讨论】:

  • 如果您也可以发布您的代码会更容易,默认情况下它不会添加任何下划线,必须针对您的情况。在nicesnippets.com/live/…查看工作演示
  • 欢迎来到 StackOverflow!为了让我们更好地帮助您,您能否更新您的问题,以便它显示您的现有代码并在minimal, complete, and verifiable example 中详细说明任何失败的attempts made so far,并清楚说明您想要什么结果是。如需更多信息,请参阅有关how to ask good questions 的帮助文章,并采取tour of the site :)
  • 请给我们密码字段的css和html代码。还要查找在其父容器之一上设置的 text-decoration: underline; css 属性。
  • 我已经用代码更新了我的帖子。

标签: forms bootstrap-4


【解决方案1】:

这个问题很可能是由于这一行:

<label for="password"><u>Password:<u></label>

您需要修复标记并使用结束&lt;/u&gt;

<label for="password"><u>Password:</u></label>

见小提琴:https://jsfiddle.net/gjLwxk2v/6/

【讨论】:

    【解决方案2】:

    请使用代码更新您的问题。

    试试:

    style="border: none !important"
    

    或:

    style="text-decoration: none !important"
    

    在您的输入 div 上。

    【讨论】:

      猜你喜欢
      • 2020-06-04
      • 1970-01-01
      • 2019-10-06
      • 2023-03-23
      • 2012-01-04
      • 2017-12-23
      • 2020-02-23
      • 2018-11-07
      • 2018-04-08
      相关资源
      最近更新 更多