Fandom

HTML & CSS Wiki

Universal CSS Selectors

649pages on
this wiki
Add New Page
Comments0 Share

In an HTML document, Universal CSS Selectors use an asterisk (*) to matche a single element of any type. Omitting the asterisk with simple selectors has the same effect. For instance, *.warning and .warning are considered equal.

Example:

<html>
   <head> 
      <title>Title</title>
      <style type="text/css">
         *.class1 {
                   color:red;
         }
    
         *#id1 {
                color:blue;
         }
         *.green {
                  color:green;
         }
      </style>
   </head>
   <body>
     <p class="class1">
        <span id="id1">Blue text</span> followed by red text.
     </p>
     <p id="id1">
        <span class="class1">Red text</span> followed by blue text.
     </p>
     <p class="green">
        <span class="class1">Red text,</span> <span id="id1">then blue,</span> 
        followed by green.
     </p>
   </body>
</html>

See Also

CSS Selectors

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.