Forums

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

Home Forums CSS Caption Above The h2 Subheading Reply To: Caption Above The h2 Subheading

#267816
Beverleyh
Participant

I’m not really sure what you’re saying the next issue is. Are you asking how to target this special H2 in CSS without targeting a “regular H2”, which I’m taking to mean as an H2 without the .title class?

To target a “regular H2” only, you can use the H2 selector along with not();

h2:not(.title) {
/* your styles here */

To target just the H2s with a .title class;

h2.title {
/* your styles here */

Or everything with a .title class;

.title {
/* your styles here */

To target both elements at the same time (you don’t need to put them in a div in order to target them with the same CSS);

.title, .subtitle {
/* your styles here */

Does that answer your question? If not, could you rephrase?