Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a location marker glypphicon inside text input area

Im using bootstrap and trying to add a location glyphicon marker inside a text input element

I tried adding the glypicon class to the input area like this:

<input type="text" class="form-control glyphicon glyphicon-map-marker" >

I follwed an example on W3Schools with botostrap glyphicons the example included the glyphicon marker inside a <span> element NOT inside a ` element, so I belief that os where my problem is.

IM trying to achieve the following look:

enter image description here

The example website where I got the image from uses the location marker as a background image in their css...

background-image: url(data:image/png;base64);

Any advice as to how to tackle this problem, much appreciated.

like image 387
Marilee Avatar asked Oct 06 '16 04:10

Marilee


1 Answers

You could try implementing this Font Awesome icon inside the field - here's a relevant question that will help you achieve your desired result.

.wrapper input[type="text"] {
    position: relative; 
    }
    
    input { font-family: 'FontAwesome'; } /* This is for the placeholder */
    
    .wrapper:before {
        font-family: 'FontAwesome';
        color:red;
        position: relative;
        left: -5px;
        content: "\f041";
    }
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css" integrity="sha256-uXf0U0UCIqBp2J3S53b28h+fpC9uFcA8f+b/NNmiwVk=" crossorigin="anonymous" />

<p class="wrapper"><input placeholder="&#61447; Username"></p>
like image 103
Zac Collier Avatar answered Nov 15 '22 21:11

Zac Collier