How to show border using classes while there's another border attribute in css? Should I use style attribute that moment? Question
Speaking to the comment, classes is better style attribute. But, if someone already have written something in CoDesign then how can I use class for that?
e.g. I had used $tgt.addClass('has-border-width-2 has-border-color-red-700');
. And, target already has border in CoDesign. Now, I have to use !important
for showing another border and have to stop CoDesign. Is there possible way to add !important
for those classes has-border-width-2 has-border-color-red-700
. I think no. Than, how to show the border and color?
1 answer
You should almost never use a style
attribute. They're clunky, they mix HTML with CSS meaning you can't preload it, and they override just about everything else.
Instead, either use atomic classes from Co-Design, or if that doesn't work add a class of your own and write some custom CSS.
In this case, perhaps try something like this:
// JavaScript
$tgt.addClass('failed-validation');
/* CSS, app/assets/stylesheets/character_count.scss */
.failed-validation {
border: 2px solid #d21919 !important;
}
0 comment threads