admin管理员组文章数量:1311044
I'm trying to embed 'search.svg' image into textbox in AngularJS as shown in the image below
But I didn't get expected result. It's rendering like shown in the image below
I have tried - My html file
<div class="right-inner-addon pull-left col-lg-4">
<input type="text" class="form-control input-append" />
<img role="img" src="img/icons/search.svg" />
</div>
My CSS file
.right-inner-addon {
position: relative;
}
.right-inner-addon input {
padding-right: 30px;
}
.right-inner-addon img {
position: absolute;
right: 0px;
padding: 10px 12px;
pointer-events: none;
}
I'm trying to embed 'search.svg' image into textbox in AngularJS as shown in the image below
But I didn't get expected result. It's rendering like shown in the image below
I have tried - My html file
<div class="right-inner-addon pull-left col-lg-4">
<input type="text" class="form-control input-append" />
<img role="img" src="img/icons/search.svg" />
</div>
My CSS file
.right-inner-addon {
position: relative;
}
.right-inner-addon input {
padding-right: 30px;
}
.right-inner-addon img {
position: absolute;
right: 0px;
padding: 10px 12px;
pointer-events: none;
}
Share
Improve this question
edited May 7, 2014 at 13:33
Ex-iT
1,4772 gold badges12 silver badges20 bronze badges
asked May 7, 2014 at 13:19
user2067120user2067120
2673 gold badges6 silver badges18 bronze badges
2 Answers
Reset to default 3Make sure you are setting a top: 0;
(or any value that fits your needs) on your .right-inner-addon img
.
Here is a quick example.
Sample from my project
.dispensary-search {float: right; position: relative;}
.dispensary-search input { width: 300px; height: 32px; margin: 5px;}
.dispensary-search:before {content: ""; position: absolute; right: 10px; top: 0; bottom: 0; width: 20px; background: url(../images/search.svg) no-repeat right center;}
本文标签: javascriptHow to embed SVG image icon in input tagStack Overflow
版权声明:本文标题:javascript - How to embed SVG image icon in input tag? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741847845a2400887.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论