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

137
Views
Cambiar el valor de una variable css de JS provoca un comportamiento extraño
:root{ --name: "*"; } .test::before{ font-size: 13px; Content: var(--name); }
 document.documentElement.style.setProperty("--name", "test");

Quiero manipular las variables css anteriores como en este JS, pero cuando ejecuto este JS, el "*" simplemente desaparece y la "prueba" no se refleja. ¿Conoces la causa?

(Traducido por DeepL)

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

0

Tienes que hacer lo siguiente. Tenga en cuenta la cita adicional que agregué:

 document.documentElement.style.setProperty("--name", "'test'");
 :root{ --name: "*"; } .test::before{ font-size: 13px; Content: var(--name); }
 <div class="test"></div>

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!