Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP/CSS Style switcher issues & more Reply To: PHP/CSS Style switcher issues & more

#240579
Paulie_D
Member

Repetition is definitely an issue here

.btn-custom {
background-color: hsl(120, 100%, 15%);
color: hsl(120, 100%, 50%);
font-weight: bold;
border-color: #000;
border-width:3px;
}
.btn-custom1 {
background-color: hsl(240, 100%, 15%);
color: hsl(195, 100%, 50%);
font-weight: bold;
border-color: #000;
border-width:3px;
}

See how much of that is repeated

now compare it to

.btn-custom {
background-color: hsl(120, 100%, 15%);
color: hsl(120, 100%, 50%);
font-weight: bold;
border-color: #000;
border-width:3px;
}
.btn-custom1 {
background-color: hsl(240, 100%, 15%);
color: hsl(195, 100%, 50%);
}

Repeat that a dozen times and madness is heading your way.

I also note this

.blue {
border: 3px solid #0000ff;
}

I’ve removed the repeated code.

I get why you would do this but using classes or ID’s that relate to specific colors / effects is not considered a good idea….you might need to change the color and then the name makes no sense.

…and don’t get me started on all those JS functions…that’s insane.