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
I want to add a border to the same styled element with a seperate css class

I want to be able to add a border with javascript. So I thought I could do it with adding it as a seperate class . But it does not work .

#button1 {
    box-shadow:inset 0px 0px 0px 0px #3dc21b;
    background-color:#44c767;
    border-radius: 50%;
    border:1px solid #18ab29;
    display:inline-block;
    cursor:pointer;
    color:#ffffff;
    font-family:Arial;
    font-size:17px;
    padding:180px 180px;
    text-decoration:none;
    text-shadow:0px 1px 0px #2f6627;
    margin:200px;

    border: 30px solid black ;


}

.AddedbuttonBorder {
    border: 30px solid black ;


}

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

0

You are using an ID and a class as CSS selectors. The ID selector has a higher CSS specifity than the class selector, so the border setting in the ID selector will have priority over the one in the class selector, regardless of their order.

To "overrule" the setting of the ID selector, you can either add !important to the setting in the rule that uses the class selector (border: 30px solid black !important;), or use a selector that combines ID and class, like this:

#button1.AddedbuttonBorder {
    border: 30px solid black;
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

if you want to do this with javascript you can use

document.getElementById('button1').classList.add('AddedbuttonBorder');
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