Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
¿Cómo aplico CSS a este código JS Fetch para modificar la posición del texto, la fuente?

Nuevo en JS. ¿Cómo puedo aplicar CSS a este JS Fetch para modificar la posición de prueba, la fuente? Gracias.

 let file = 'art.txt'; const handleFetch = () => { fetch(file) .then((x) => x.text()) .then((y) => (document.getElementById('kdkz').innerHTML = y)); }; setInterval(() => handleFetch(), 2000);
 <p id="kdkz"></p>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Solo agrega

 #kdkz { /*styling here*/ }

El navegador aplicará el estilo después de buscar.

about 4 years ago · Juan Pablo Isaza Report

0

Modifique handleFetch() a:

 const handleFetch = () => { fetch(file) .then((x) => x.text()) .then((y) => { const target = document.getElementById('kdkz'); target.innerHTML = y; target.style.textAlign = 'center'; // Change the position here. }); };

O bien, puede agregar estilo fácilmente dentro del documento HTML usando la etiqueta <style> antes del <body> .

 <style> #kdkz { text-align: center; /* Change the position here */ } </style>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!