Forums

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

Home Forums CSS how to inherit from nonparent element Reply To: how to inherit from nonparent element

#238755
Nick Levinson
Participant

True, it’s not nonchild, but it’ll do and, meanwhile, I’ve emailed a proposal to the CSS people to support nonchild inheritance, although I think they may decline if there are not already two implementations (in, e.g., browsers) in the wild and one answer said “[a] big problem is loops. Inheritance is loop free.”

I’m not clear how I’d use a div to like effect without breaking other markup intended to be standards-compliant and supportive of searches. I guess I’d define all the characteristics of headline-like styles. And for the concept of an h1 class to mimic an h1 element (or h[n] of h[n]), I’d be back to needing to know how browsers style the h1 (or h[n]) element. Maybe I haven’t thought it through enough yet, and someone suggested https://www.w3.org/TR/css-variables/ which I want to look into, but the span solution will probably be it until I do.

Thanks for the interaction.