Jump to content
smus

Universal selector

Recommended Posts

Is it possible to apply to several tags with one selector, not creating class for it? For example, I want a common property for all headings in the document:

h1, h2, h3{color: orange;}

<h1>h1</h1>

<h2>h2</h2>

<h3>h3</h3>

Something like h^{color: orange;} for tag selectors?

 

Share this post


Link to post
Share on other sites

There is only 6?, you don't have apply a class  to all, just the parent
 

<div class="myheadercolor">

<h1>h1</h1>

<h2>h2</h2>

<h3>h3</h3>

</div>
.myheadercolor h1, .myheadercolor h2,.myheadercolor h3 {color: orange;}

 

Share this post


Link to post
Share on other sites

:) naive solution, because, hypothetically, headings might be scattered around the document.

No, I was just wondering why developers invented such convenient thing, but did not apply it to tag names. Philosophical question :)

Share this post


Link to post
Share on other sites

As they are part of the same document, representing main title heading and sub headings of importance, No! not really, as they, would come under the same parent element. IF they were scattered anywhere, then they are not used as they were properly intended.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×