Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何将警告/错误消息正确地放入twitter引导水平表单(在输入的右侧)?_Html_Css_Twitter Bootstrap 3_Alert_Messagebox - Fatal编程技术网

Html 如何将警告/错误消息正确地放入twitter引导水平表单(在输入的右侧)?

Html 如何将警告/错误消息正确地放入twitter引导水平表单(在输入的右侧)?,html,css,twitter-bootstrap-3,alert,messagebox,Html,Css,Twitter Bootstrap 3,Alert,Messagebox,我想在tbs3中以水平形式将警告消息放在输入的右侧 我现在有一个问题: <div class="form-group"> <label class="col-sm-2 control-label">Лицевой счет: *</label>

我想在tbs3中以水平形式将警告消息放在输入的右侧

我现在有一个问题:

<div class="form-group">                                                                                                          
    <label class="col-sm-2 control-label">Лицевой счет: *</label>                                                                 
    <div class="col-sm-1">                                                                                                        
        <input class='form-control' placeholder='л/с' autocomplete='off' id='acc' type='text' value='{$_POST['acc']}' name='acc'> 
    </div>                                                                                                                        
    <div class="col-sm-9">                                                                                                        
        <p class="bg-danger">Here is a tip!</p>                                                                                   
    </div>                                                                                                                        
</div>  
我明白了:

所以问题是如何在输入右侧的样式块中正确呈现警告消息


正确的意思是具有与输入相同的高度。

若要解决此问题,您可以创建一个自定义CSS规则,命名为任意名称(我将其命名为我的
。警报错误
)。然后使用这个CSS:

.alert-error {
   padding: 6px 15px;
   height: 34px;
}
控件的高度为34px。只需重新调整警报中的填充,并将其高度设置为34px

顺便说一下,我用了你的第二个例子来得出这个结论。我希望这对您有所帮助。

只需更换即可

<p class="bg-danger"></p> 


div元素已经有一个内置的填充,这就是高度不同的原因

对于这个,使用这个

<div class="form-group">                                                                                                          
    <label class="col-sm-2 control-label">Лицевой счет: *</label>                                                                 
    <div class="col-sm-1">                                                                                                        
    <input class='form-control' placeholder='л/с' autocomplete='off' id='acc' type='text'  value='{$_POST['acc']}' name='acc'> 
    </div>                                                                                                                        
    <div class="col-sm-9">                                                                                                        
        <div class="alert alert-danger" role="alert">Here is a tip!</div>                                                                                   
    </div>                                                                                                                        
</div>

Лицевой счет: *                                                                 
这是一个提示!

我的第二段代码与您的代码有什么区别?
<div class="alert alert-danger"></div> 
<div class="form-group">                                                                                                          
    <label class="col-sm-2 control-label">Лицевой счет: *</label>                                                                 
    <div class="col-sm-1">                                                                                                        
    <input class='form-control' placeholder='л/с' autocomplete='off' id='acc' type='text'  value='{$_POST['acc']}' name='acc'> 
    </div>                                                                                                                        
    <div class="col-sm-9">                                                                                                        
        <div class="alert alert-danger" role="alert">Here is a tip!</div>                                                                                   
    </div>                                                                                                                        
</div>