【问题标题】:How to edit the height input-group-addons如何编辑高度输入组插件
【发布时间】:2017-12-28 10:05:44
【问题描述】:

我有一个带有字形图标的文本字段,悬停时显示工具提示。我在该文本字段之外添加了一个标签。之后我无法使用文本字段的大小修复输入组插件的高度

$("a.my-tool-tip").tooltip();
a.my-tool-tip,
a.my-tool-tip:hover,
a.my-tool-tip:visited {
  color: black;
}

.input-group {
  margin-top: 100px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>


<div class="input-group">
  <label for="my-label">My Label</label>
  <input type="text" class="form-control" name="security" id="security">
  <p class="unit">You msg here</p>
  <span class="input-group-addon">
            <a class='my-tool-tip' data-toggle="tooltip" data-placement="left" title="Tooltip here">
                <i class='glyphicon glyphicon-info-sign'></i>
            </a>
        </span>
  </input>
 
</div>

【问题讨论】:

    标签: html css twitter-bootstrap-3


    【解决方案1】:

    这是一个肮脏的解决方案!

    $("a.my-tool-tip").tooltip();
    a.my-tool-tip,
    a.my-tool-tip:hover,
    a.my-tool-tip:visited {
      color: black;
    }
    
    .input-group {
      margin-top: 100px;
    }
    
    label[for="my-label"] {
    position: absolute;
    top: -30px;
    }
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    
    
    <div class="input-group">
      <label for="my-label">My Label</label>
      <input type="text" class="form-control" name="security" id="security">
      <span class="input-group-addon">
                <a class='my-tool-tip' data-toggle="tooltip" data-placement="left" title="Tooltip here">
                    <i class='glyphicon glyphicon-info-sign'></i>
                </a>
            </span>
      </input>
    </div>

    制作标签absolute

    【讨论】:

    • 感谢您提供肮脏的解决方案 :) 我的要求略有变化。输入后我有一个 p 标签。我该如何解决这个问题。
    • 欢迎您 :) 我认为您也应该制作 absolute p 标签。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-13
    • 2021-11-15
    • 2014-08-21
    相关资源
    最近更新 更多