CSS '*' SELECTOR; WHAT IS IT?

Pravesh Singh

Total Post:412

Points:2888
Posted by  Pravesh Singh
 1176  View(s)
Ratings:
Rate this:
Hi Everyone!

I have seen many time in css file greater than sign "*", but not understand why used it.
Please provide any suitable demo.

Please help me!
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: CSS '*' selector; what is it?

    Hi Pravesh!

    Syntax

    *
    {
        write something here.......!
    }

    Selects all elements

    For example

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            * {
                background-color: #e5e5e5;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div id="red" style="height: 150px; border: 2px solid #ff0000;">
                <div id="green" style="height: 60px; border: 2px solid #00ff00;">
                    <p>Star sign (*) CSS Selector demo</p>
                </div>
            </div>
        </form>
    </body>
    </html>
     
    From the above example, you can see "background-color" apply on html element such that <body>, <div>, <p>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!