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

149
Views
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 answers
Answer question

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