Grow your CSS skills. Land your dream job.

[Solved] What is the purpose of putting "*" in css?

  • # March 29, 2014 at 3:11 am

    Hello guys, I was just trying to cleaning my CSS in bootstrap, but I found lot’s places they had putted “*” before CSS property..why?

    Thanks
    Rihan

    # March 29, 2014 at 3:29 am

    1)If you mean the star selector – The star symbol will target every single element on the page.

    * {
     margin: 0;
     padding: 0;
    }
    

    It can even be used to target descendant elements

    #container * {
     border: 1px solid black;
    }
    

    2) Css comments are inserted like this

    /* Your comment */
    
    # March 29, 2014 at 3:33 am

    No see the following coding -

    #container {
      border: 1px solid black;
    *border: 1px solid black;
    }
    # March 29, 2014 at 3:37 am

    And also what is the meaning of this ?

    .container {
    background-color: #080808 \9;
    background-color: #080808;
    }
    # March 29, 2014 at 5:36 am

    They are both ‘hacks’ for older versions of Internet Explorer.

    See broswerhacks.com or http://css-tricks.com/snippets/css/browser-specific-hacks/

    # April 23, 2014 at 10:41 pm

    Thanks everyone :-)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".