I have the following html code:
<div class="inlineSearchDiv">
<i class="fa fa-search"></i>
</div>
where the css code looks like following:
.inlineSearchDiv {
position:absolute;
height:100%;
width: 100px;
margin-right:-100px;
right:0;
top:0;
float:right;
text-align:center;
cursor:pointer;
}
I would like to know, how can I force my icon to be in the center of the div element (horizontally & vertically)? Here was my try:
.inlineSearchDiv i {
-moz-transform: translate(0,50%);
-ms-transform: translate(0,50%);
-o-transform: translate(0,50%);
-webkit-transform: translate(0,50%);
transform: translate(0,50%);
}
however shall the height of the inlineSearchDiv
changed, then my transform
property was no longer refreshed