Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

207
Vistas
Why does my CSS Close button have two X characters?

I am currently making an expense tracker, where when someone inputs their expenses, it appears in a history div. I am bit confused as to how to approach this.

Here is an example output:

Example output

However, if you look closely, the button appears twice. I am confused as to how to solve this problem. I got the CSS code for the button from StackOverflow but changed it a bit.

Thanks.

function showHistory() {
  var count = values.length;
  document.getElementById('history').innerHTML = "";
  for (var i = 0; i < count; i++) {
    //class="btn-close btn-close-white"

    var st1 = "<div class='row' id='r1'><div class='col-md-7 border'>" + values[i].text + "<div class='row' id='r1'><div class='col-md-7'>" + values[i].brand + "</div>" + "<div class='col-md-3'>" + values[i].amnt + "</div>" + "<div class='col-md-1'><button class='close-icon' onclick='deleteam(\"" + values[i].id + "\")'>&times;</button></div></div>";
    var st2 = "<div class='row border' id='r2'><div class='col-md-7'>" + values[i].text + "<div class='row' id='r2'><div class='col-md-7'>" + values[i].brand + "</div>" + "<div class='col-md-3'>" + values[i].amnt + "</div>" + "<div class='col-md-1'><button class='close-icon' onclick='deleteam(\"" + values[i].id + "\")'>&times;</button></div></div>";
    (parseFloat(values[i].amnt) < 0) ? document.getElementById('history').innerHTML += st2: document.getElementById('history').innerHTML += st1;
  }
}
.close-icon {
  display: block;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border-width: 3px;
  border-style: solid;
  border-color: rgb(57, 100, 199);
  border-radius: 100%;
  background: -webkit-linear-gradient(
      -45deg,
      transparent 0%,
      transparent 46%,
      white 46%,
      white 56%,
      transparent 56%,
      transparent 100%
    ),
    -webkit-linear-gradient(45deg, transparent 0%, transparent 46%, white 46%, white
          56%, transparent 56%, transparent 100%);
  background-color: rgb(57, 100, 199);
  transition: all 0.3s ease;
}
<div class="container" id="history"></div>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is because you have CSS to generate the X but also have &times; unicode therefore it will have 2X, simply remove &times; from inside button

Note: Also you may delete the vendor prefixes for linear gradients

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda