Put search icon near textbox using bootstrap

前端 未结 5 1790
清酒与你
清酒与你 2020-12-02 08:51

I am using bootstrap by default textbox taking full width of column and I want to put search icon at the end to textbox.

My code is like this:



        
5条回答
  •  执念已碎
    2020-12-02 09:31

    Adding a class with a width of 90% to your input element and adding the following input-icon class to your span would achieve what you want I think.

    .input { width: 90%; }
    .input-icon {
        display: inline-block;
        height: 22px;
        width: 22px;
        line-height: 22px;
        text-align: center;
        color: #000;
        font-size: 12px;
        font-weight: bold;
        margin-left: 4px;
    }
    

    EDIT Per dan's suggestion, it would not be wise to use .input as the class name, some more specific would be advised. I was simply using .input as a generic placeholder for your css

提交回复
热议问题