简体   繁体   中英

how to make two elements to be in the same line - html css

I have this code:

<div class="{{($type != 'forecast')?'col-md-8':'col-md-8'}}">
    <div class="form-group">
        <label>Name:</label>
        <input type="text" class="form-control" name="name" value="12" {{($viewOnly)?'disabled':''}} >
        <i class="fa fa-info-circle" title="test"></i>
    </div>                                 
</div>

this is the UI在此处输入图像描述

I just want the <i> icon be next to the input field and not in the bottom.

How I can achieve that?

Wrap the input field and the icon within a div with the class input-group .

<div class="input-group">
   <input type="text" class="form-control" name="name" value="12" {{($viewOnly)?'disabled':''}}>
   <i class="fa fa-info-circle" title="test"></i>
</div>

this is the solution

<div class="form-group">
  <label>Name:</label>
  <div class="input-group" style="display: flex">
      <input type="text" class="form-control" name="name" value="12" {{($viewOnly)?'disabled':''}} >
     <i class="fa fa-info-circle" title="test"></i>
 </div>  
</div> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM