1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

what does this sign on css means * { }

Discussion in 'CSS' started by Megamon, Nov 7, 2013.

  1. #1
    So i have seen around a while now this symbol and i am wondering what it does.



    * {

    margin:0;

    }



    about * do you know what it does? if yes can you tell me thank you.
     
    Solved! View solution.
    Megamon, Nov 7, 2013 IP
  2. #2
    The asterisk (*) has a spectrum of meanings, depending on how it is used.

    * {} targets all elements within that portion of the DOM. It is usually referred to as a 'wildcard'.
    Then you have ELEMENT * {}, which selects all elements within the ELEMENT element. For instance, div * {} selects all elements that have DIV for a parent.
    It is rarely used, and its use is VERY rarely justified. The one case it IS justified is this one:

    * {
            -webkit-text-size-adjust:none;
            -ms-text-size-adjust:none;
        }
    Code (markup):
    That little snippet prevents handheld devices from altering the text size. Some devices lie about their resolution, so they make text really small to fake it.

    * { outline:none} is commonly seen, but it makes browsing difficult for keyboard navigators. Same goes for * {margin:0} -- it makes some HTML elements difficult to work with.
    You can also use it to target elements by their nesting level by using the corresponding number of asterisks, but this function is very ambiguous and not really worth explaining. It's used for debugging, for example.

    Then there's the asterisk hack, used to target IE7 and below. And it goes *PROPERTY:VALUE. It may come in handy when your code isn't compatible with old IE versions so that you don't have to use conditional comments, but it is invalid CSS. Actually, you can use any not-alphanumeric character instead of that asterisk (a few exceptions), but that one is widely used. It should not be abused, as its use is not really ideal.
     
    wiicker95, Nov 7, 2013 IP
  3. Megamon

    Megamon Member

    Messages:
    80
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    43
    Digital Goods:
    1
    #3
    what is dom?

    About this one:

    If i put a smaller size on body element that it means the divs who got * { } will have the original size? is that right?


    thanks for the answer i will keep the mind that i can target all element with * { } :)
     
    Megamon, Nov 8, 2013 IP
  4. Bogdanel

    Bogdanel Active Member

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #4
    DOM is an abbreviation from Document Object Model ;)
     
    Bogdanel, Nov 8, 2013 IP
  5. Jeremy Benson

    Jeremy Benson Well-Known Member

    Messages:
    364
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    123
    #5
    The DOM is basically a hierarchy of all the HTML elements in an HTML file. Elements in HTML are tagged, like <p></p> That's a block element, so every paragraph drops down on a block. There are inline elements like <i></i> which italicizes text. These can be used in block elements. That's why they're called inline...

    back to the DOM... have you seen an HTML file before?

    <html>
    <head>
    <title></title>
    </head>
    <body>
    </body>
    </html>

    That's the basic outline of an empty DOM. Say you had something like this.

    <html>
    <head>
    <title></title>
    </head>
    <body>
    <div><p>This would make a one line paragraph.</p></div>
    </body>
    </html>

    If you can picture the DOM like a tree you would have one big branch being the body element, and then it's children (in this case the DIV), and the paragraph which would be a child of the div, and the body element would be grandparent or ancestor to the paragraph.

    umm if you really want to learn get some books on HTML and CSS, or find some tuts... long road from this point, but fun process of learning.
     
    Last edited: Nov 13, 2013
    Jeremy Benson, Nov 13, 2013 IP