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

152
Vistas
Adding CSS properties to JavaScript Quiz

So I am making a quiz, a simple one. I am currently trying to add CSS to the different lines.

const quizContainer = document.getElementById('quiz');
const resultsContainer = document.getElementById('results');
const submitButton = document.getElementById('submit');
const myQuestions = [{
  question: "What is used primarily to make the Quiz?",
  answers: {
    a: "CSS",
    b: "JavaScript",
    c: "HTML"
  },
  correctAnswer: "b"
}];

An example is adding padding or color to the question:

"What is used primarily to make the Quiz?""

Thank you :)

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

0

You can use style property of the element to style the elements:

const quizContainer = document.getElementById('quiz');
const resultsContainer = document.getElementById('results');
const submitButton = document.getElementById('submit');

quizContainer.style.color = "color";
quizContainer.style.padding = 20; 

And can parse different styles with every question to style every question differently:

const myQuestions = [
           {
                question: {
                     title : "What is used mainly to primarily the Quiz?",
                     style : {
                        color = "color";
                        padding = 20;
                     }
                }
           }
];
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