Answer the question
In order to leave comments, you need to log in
Can css be made into an array?
Hello.
There are several pages on the site that display the styles of the same block.
.nonebefore .blanks a:before,
.nonebefore .zakoni a:before,
.nonebefore .sud_arbitr a:before,
.nonebefore .sud_msk a:before,
.nonebefore .mfc a:before,
.nonebefore .zags_msk a:before,
.nonebefore .notary_msk a:before,
.nonebefore .notary_mo a:before,
.nonebefore .court_practice a:before{
content: none;
}
.nonebefore, .aaa, .bbb {
.blanks a:before,
.zakoni a:before,
.sud_arbitr a:before,
.sud_msk a:before,
.mfc a:before,
.zags_msk a:before,
.notary_msk a:before,
.notary_mo a:before,
.court_practice a:before{
content: none;
}
}
Answer the question
In order to leave comments, you need to log in
If the names of the parent classes are similar, then you can do this:
Will be applied to elements whose class starts withmyClass
I don't know about pseudo-elements if they will work, but
function addStyleToHead(c) {
var css = `${c} .blanks a:before,
${c} .zakoni a:before,
${c} .sud_arbitr a:before,
${c} .sud_msk a:before,
${c} .mfc a:before,
${c} .zags_msk a:before,
${c} .notary_msk a:before,
${c} .notary_mo a:before,
${c} .court_practice a:before{
content: none;
}`,
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
if (style.styleSheet){
// This is required for IE8 and below.
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
addStyleToHead('.bbb')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question