gpt4 book ai didi

css - Bootstrap : Glyphicon icon going out of the input boxes right edge

转载 作者:行者123 更新时间:2023-11-28 10:45:47 25 4
gpt4 key购买 nike

我试图在带有 bootstrap(bootstrap.min.css) 的表单中添加用于验证的字形图标,但我不希望表单的输入字段拉伸(stretch)并跨越整个浏览器的宽度窗口

(example)

所以我将输入字段包含在 Grid(col-sm-x) 中,现在我想使用输入框右侧的字形进行验证。当我删除网格样式时它工作正常但我不希望输入字段字段那么宽并使用字形这是代码

    <div class="form-group has-success has-feedback">
<label class='control-label' for='p_name'>Name of Corner: </label>
<div class='row'>
<div class='col-sm-4'>
<input id='p_name' name='p_name' type='text' class='form-control' placeholder="Santy's Burgers">
<span class='glyphicon glyphicon-ok form-control-feedback' area-hidden='true'></span>
</div>
</div>
</div>

这是发生了什么

(link to the picture)

右边的字形超出了输入主体

最佳答案

你需要为输入和字形添加一个类

并给定相对位置的类

.right-inner-addon {
position: relative;
}
<link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css"/>
<div class="form-group has-success has-feedback">
<label class='control-label' for='p_name'>Name of Corner: </label>
<div class='row'>
<div class='col-sm-4'>
<div class="right-inner-addon">
<input id='p_name' name='p_name' type='text' class='form-control' placeholder="Santy's Burgers">
<span class='glyphicon glyphicon-ok form-control-feedback' area-hidden='true'></span></div>
</div>
</div>
</div>

关于css - Bootstrap : Glyphicon icon going out of the input boxes right edge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27996840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com