D. Brader D. Brader - 1 month ago 8
HTML Question

Move CSS ::after element into element

Hello everyone I was wondering how I get the

element from my
search field into the input field itself (http://i.imgur.com/CqsFKfE.png).

I've tried some things but at the end my result was to set the CSS style for the
element to
margin-left: -25px;

Im not sure if this is the best solution, especially because I am using a negative value for margin. Is there any better solution for this? Or is this the only way?

Answer Source

You can set it using position

.parentElement {
    position: relative;

.childElement {
    position: absolute;
    top: 5px;
    right: -25px;