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

245
Vistas
How do I "unitalicize" a single word in an HTML span container that is already styled for italics?

Inputing text via java into an HTML span container, like this:

<p><span id="myID" style="text-align: justify; display: block; font-style: italic;"></span>...

In the text I am inputing, in one case, a single word is not italic. How do I unitalicize the word?

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

0

document.getElementById("myID").style.fontStyle = "normal";

about 4 years ago · Juan Pablo Isaza Denunciar

0

Modern front-end methods suggest you use CSS classes instead of inline styles in the markup.

Set the span to one main class identified by the id, and an italic class, and then use the JS to toggle the italic class off with classList.

// Cache the element, and set the innerText
const span  = document.querySelector('#myID');
span.innerText = 'This is my text.';

// For an example wait one second to
// toggle the italic class
setTimeout(() => {
  span.classList.toggle('italic');
}, 1000);
#myID { text-align: justify; }
.italic { font-style: italic; }
<p><span id="myID" class="italic"></span></p>

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