Place dollar symbol inside a text input

Viewed 7668

I want to keep dollar symbol at beginning of text box. I am able to achieve this using the below code.

It works find in chrome and IE. The dollar symbol goes and sits next to label in firefox. How do i fix this problem? And for aligning the dollar symbol inline with text i use top 2px. Is there a way to better the css code.

.input-symbol-dollar:after {
  color: #37424a !important;
  content: "$";
  font-size: 16px !important;
  font-weight: 400;
  left: 10px;
  position: absolute;
  top: 2px;
}

.input-symbol-dollar {
  position: relative;
}

.abc-input {
  border: 2px solid #c9c9c9;
  box-shadow: none;
  color: #6b6f72;
  font-size: 0.9375rem;
  text-transform: none;
  width: 100%;
  color: #37424a !important;
  font-family: "Roboto Regular", sans-serif;
  font-size: 16px !important;
  font-weight: 400;
  height: 42px !important;
  padding-left: 17px !important;
  display: inline-block !important;
}

label {
  color: #37424a;
  display: inline-block;
  font-family: "Roboto Bold", sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}
<label for="abcInput" class="abc-label">lable filed </label>
<span class="input-symbol-dollar">
<input  type="text" id="abcInput" tabindex="0" name="abc" class="abc-input "  placeholder="0.00"></span>

https://jsfiddle.net/8jdek3zt/5/

4 Answers
Related