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

174
Views
CSS no cambia el estilo de un botón

Estoy tratando de cambiar el color de fondo de un botón en css. El enlace CSS funciona bien, el botón cambia de color cuando trato de aplicar bootstrap o uso DOM para cambiar el color, pero no cuando uso CSS.

Aquí está el código:

 // let sexybutton= document.querySelector('.sexy'); // sexybutton.style.backgroundColor="red"; // console.log(sexybutton.style); //Currently commented it out because I do not want to do it this way. Put this here to inform that the button style changes using this method.
 .body{ background-color:#CCD6A6 }; .sexy{ background-color: red };
 HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="https://kit.fontawesome.com/fdee82af88.js" crossorigin="anonymous"></script> <link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/album/"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet"> <!-- Bootstrap core CSS --> <link href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom styles for this template --> <link rel="stylesheet" href="style.css"> </head> <body class="body" > <button class="sexy" type="submit">Click this</button> </body> <script src="index.js"></script> </html>

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

0

Su sintaxis CSS es incorrecta. El punto y coma ; debe colocarse después de cada propiedad CSS, no después de cada regla CSS.

 .body{ background-color:#CCD6A6; } .sexy{ background-color: red; }
 <!-- Bootstrap core CSS --> <link href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css" rel="stylesheet"> <body class="body" > <button class="sexy" type="submit">Click this</button> </body>

about 4 years ago · Juan Pablo Isaza Report

0

CSS no es un C/C++ o cualquier otra cosa que requiera punto y coma. No puede escribir un punto y coma al final del estilo.

Tu escribiste;

 .body{ background-color:#CCD6A6 }; .sexy{ background-color: red };

pero esta es la correcta;

 .body{ background-color:#CCD6A6; } .sexy{ background-color: red; }

Debe escribir punto y coma hasta el final de la línea. Como puede ver, la línea termina en : red; . No como };

about 4 years ago · Juan Pablo Isaza Report

0

es ilegible, su ubicación de punto y coma no es correcta

 .body{ background-color:#CCD6A6 }; .sexy{ background-color: red };

correcto

 .body{ background-color:#CCD6A6; } .sexy{ background-color: red; }
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!