css - Bootstrap 3 Placing Icon inside input field -


i working in bootstrap 3 , trying calendar icon inside right hand side of input box.

my html looks this:

<div class="col-md-12">     <div class='right-inner-addon col-md-2 date datepicker'           data-date-format="yyyy-mm-dd">         <input name='name' value="" type="text" class="form-control date-picker"                data-date-format="yyyy-mm-dd"/>         <i class="fa fa-calendar"></i>     </div> </div> 

i have tried position: absolute this:

.right-inner-addon {     position: absolute;     right: 5px;     top: 10px;     pointer-events: none;     font-size: 1.5em; } .right-inner-addon {     position: relative; } 

but when great in 1 spot, not positioned correctly in instance.

i have tried see if use text-indent see if work throughout, had same effect.

.right-inner-addon i,  .form-group .right-inner-addon {     display: inline-block;     z-index: 3;     text-indent: -15px;     font-size: 1.3em; } 

here's jsfiddle might help

you can use input-group add-on input-group-btn.

<div class="col-md-12">     <div class='input-group add-on col-md-2 date datepicker'           data-date-format="yyyy-mm-dd">         <input name='name' value="" type="text" class="form-control date-picker"                 data-date-format="yyyy-mm-dd"/>         <div class="input-group-btn">             <button class="btn btn-default">                 <i class="fa fa-calendar"></i>             </button>         </div>     </div> </div> 

with little css hide button border:

/* remove border between controls */ .add-on .input-group-btn > .btn {     border-left-width: 0;     left:-2px;     -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);             box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } /* stop glowing blue shadow */ .add-on .form-control:focus {     -webkit-box-shadow: none;              box-shadow: none;     border-color:#cccccc;  } 

demo: http://bootply.com/128059


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -