I want glyphicon-remove
to be placed at the right end of input text box, here's my code-
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
position: relative;
background-color: rgba(0,0,0,0.9);
height: 100vh;
}
.content{
text-align: center;
position: absolute;
width: 100%;
top: 50%;
left: 50%;
transform:translate(-50%,-50%);
}
.fill_text{
width: 20%;
height: 42px;
background-color: #DDD;
border-radius: 20px;
font-size: 20px;
padding: 10px;
border: 5px solid #E35F14;
margin: 10px auto;
outline: 0;
position: relative;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="content">
<input type="text" class="fill_text">
<span class="glyphicon glyphicon-remove"></span>
</input>
</div>
I am setting the position of input text box as relative and I have tried by giving the position of the remove icon as absolute, but that's not working. Could you tell me why that's not working?
No elements are allowed inside
<input>
elements.
add this CSS
.glyphicon-remove{
position: absolute;
top: 50%;
right: 30px;
z-index:10;
}
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
position: relative;
background-color: rgba(0,0,0,0.9);
height: 100vh;
}
.content{
text-align: center;
position: absolute;
width: 100%;
top: 50%;
left: 50%;
transform:translate(-50%,-50%);
}
.fill_text{
width: 20%;
height: 42px;
background-color: #DDD;
border-radius: 20px;
font-size: 20px;
padding: 10px;
border: 5px solid #E35F14;
margin: 10px auto;
outline: 0;
position: relative;
}
.glyphicon-remove{
position: absolute;
top: 50%;
right: 30px;
z-index:10;
cursor:pointer;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="content">
<input type="text" class="fill_text"/>
<span class="glyphicon glyphicon-remove"></span>
</div>