Optimize code?

Is there a way to reduce the following to a single instruction? I have multiple sub-pages that require the same code

.ccm-page-id-282 #achillea-header-masthead {
display: none;
}
.ccm-page-id-268 #achillea-header-masthead {
display: none;
}
.ccm-page-id-267 #achillea-header-masthead {
display: none;
}

What are you trying to do?

If it’s hide something on each page I would make a checkbox attribute and then add some code to you template to say if this page has this attribute ticked apply this CSS class.

Hi Tim

Thank you - it’s not my theme, and I am not a coder. I was just wondering if CSS had the capability of a comma delineated type instruction - one instruction covering multiple page ID’s

Yes, you can do this:

.ccm-page-id-282 #achillea-header-masthead, 
.ccm-page-id-268 #achillea-header-masthead,
.ccm-page-id-267 #achillea-header-masthead {
display: none;
}

Hi Dave

Many thanks, that will certainly help. A pity it cannot do this:)

.ccm-page-id-267,268, 282 #achillea-header-masthead {
display: none;
}

1 Like

No problem. It would be nice to be able to do that, maybe in the future, you never know :slight_smile: