Home > DeveloperSection > Forums > CSS '*' selector; what is it?
Pravesh Singh

Total Post:411

Points:2881
Posted on    April-16-2013 1:56 AM

 CSS-CSS3 CSS-CSS3 
Ratings:


 1 Reply(s)
 912  View(s)
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!


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    April-16-2013 8:28 AM

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>


Don't want to miss updates? Please click the below button!

Follow MindStick