Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
Placing password visibility icon inside password field

I have this following code.

<div class="login-password">
              <label for="password" class="form-label"
                >Enter your password</label
              >
              <input
                id="loginPassword"
                type="password"
                class="form-control"
                placeholder="Enter your password"
              />
              <i
                class="bi bi-eye-slash"
                id="togglePassword"
                style="margin-left: -30px; cursor: pointer"
              ></i>
</div>

When I do this the password visibility icon is placed as in the image given below.

enter image description here

How do I place the visibility icon within password field.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Using marketwatch.com's login as an example, you would have to make the css property 'position' to "absolute" for the <i> tag. This will allow you to place it inside the input box. Perhaps something like this:

.bi-eye-slash {
    width: 25px;
    height: 25px;
    position: absolute;
    z-index: 200;
    top: 28px;
    right: 10px;
    cursor: pointer;
}
about 4 years ago · Juan Pablo Isaza Relatório

0

I found the answer to my own question. Well, we have to group the input and the icon is the way to do it, and below is the code.

.input-group-addon i {
    margin-left: -30px;
    cursor: pointer;
    z-index: 200;
    position: absolute;
    font-size: large;
    color: #6c757d;
  }
 <link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css"
/>

<div class="login-password">
                  <label for="password" class="form-label"
                    >Enter your password</label
                  >
                  <div class="input-group">
                    <input
                      id="loginPassword"
                      type="password"
                      class="form-control"
                      placeholder="Enter your password"
                    />
                    <div class="input-group-addon">
                      <i class="bi bi-eye-slash" id="togglePassword"></i>
                    </div>
                  </div>
                </div>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda