jfox jfox - 1 year ago 104
Sass (Sass) Question

How to use :first-child with tag

This seems like the silliest question, but it has got me stuck. I'm semantically struggling to combine a pseudo selector and tagname with sass

This is what I'm trying to do:

.parent {
&:first-child.. if h4 {
// styles

I don't want to target all first childs, just those that happen to be a h4.

If it had a class it would just be

Answer Source

You need to insert the tag name before the classname: