Web Analytics Made Easy -
StatCounter * reference - CodingForum

Announcement

Collapse
No announcement yet.

* reference

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • * reference

    I have been looking at sites css files and this one appears on a few

    /* CSS Document */

    * {
    margin:0;
    padding:0;
    outline:none;
    }

    If i take it out it stops the page displaying correctly can some explain why and what it does?
    .pLeAd InSaNiTy.

  • #2
    It's the universal selector
    Digitalocean Cloud Hosting (Referral link - get $10 free credit) Fameco

    Comment


    • #3
      asterisk (*) is wild character used in CSS to target all elements. Means properties defined in * { ...} will be applicable to all HTML element.




      In your code, It will reset margin and padding to zero.



      Comment


      • #4
        ok cheers i thought it was something along this lines but i cant seem to figure out why it doesnt work if i put the same info in the body tag? what is the reason for this?
        .pLeAd InSaNiTy.

        Comment


        • #5
          Originally posted by syco__ View Post
          ok cheers i thought it was something along this lines but i cant seem to figure out why it doesnt work if i put the same info in the body tag? what is the reason for this?
          Because the body element is not every element.

          body { } selects only the body element
          * { } selects every element.
          Blog | Twitter
          Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
          CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
          Remember: no link, no code, no help!

          Comment

          Working...
          X