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

249
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório

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 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