wersimmon
wersimmon

Reputation: 2869

Is there a way to tell the user-agent "treat this tag like that one"?

I want <foo> tags to act exactly equivalent to <bar> tags, without knowing anything about the styles applied by the site's stylesheet, user's stylesheet, or the default user agent behavior. For example, making a <bq> tag which acts exactly like a <blockquote> tag or a <latinname> tag that should inherit from the <em> tag's styles.

In other words, is there a way to tell foo to inherit everything from bar's style?

Upvotes: 1

Views: 57

Answers (2)

Aaron McIver
Aaron McIver

Reputation: 24723

CSS inheritance is on a property by property basis. So unless you explicitly state to inherit via the property, the default value will be used.

Another approach is to set up classes which can live across tags. Keep in mind that the tags should be the structure, not the style.

Upvotes: 2

Eli Grey
Eli Grey

Reputation: 35913

If you must, use the CSSOM and iterate through every selector of every rule of every stylesheet (document.styleSheets), replacing foo with bar where appropriate. I'd recommend you use CSS classes instead.

Upvotes: 1

Related Questions