Home › Forums › CSS › Caption Above The h2 Subheading › Reply To: Caption Above The h2 Subheading
March 4, 2018 at 8:54 am
#267816
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?