Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

CSS positioning question

Garrett85Garrett85 Member Posts: 168
In the following code, what is the the purpose of the *{margin: 0;}?
First I don't understand what it affects since it's not attached to the body or anything else, second what the heck is (*) for?





working with style


*{margin: 0;}

#content {
position: relative;
left: 45px;
top: 10px;
width: 400px:
border: 1px soid red;
}


The Black Cat

I married early, and wad happy to find
in my wife a disposition not uncongenial with my own. Observing my partiality for domestic
pets, she lost no opportunity of procuring those of the most agreeable kind. We had birds,
gold fish, a fine dog, rabbits, a small monkey, and a cat.

This latter wass a remarkably larg and beautiful
animal, entirely black, and sagacious to an astonishing degree. In speaking of his intelligence,
my wife, who at heart was not a little tinctured with supersition, made frequent allusion to the
ancient poplular notion, which regarded all black cats as witches in disquise. Not that she was
ever serious uon this point - and I mention the matter at all for no better reason that that it
happens, just now, to be remembered.

Pluto - this was the cat's name - was my favorite
pet and playmate. I alone fed him, and he attended me wherever I went about the house. It was
even with difficuly that I could prevent him from following me though the streets.



Comments

  • anthrax11anthrax11 Member Posts: 511
    : In the following code, what is the the purpose of the *{margin: 0;}?
    : First I don't understand what it affects since it's not attached to the body or anything else, second what the heck is (*) for?
    :
    [code]
    :
    :
    :
    :
    : working with style
    :
    :
    : *{margin: 0;}
    :
    : #content {
    : position: relative;
    : left: 45px;
    : top: 10px;
    : width: 400px:
    : border: 1px soid red;
    : }
    :
    :
    :
    :
    :

    The Black Cat

    :

    I married early, and wad happy to find
    : in my wife a disposition not uncongenial with my own. Observing my partiality for domestic
    : pets, she lost no opportunity of procuring those of the most agreeable kind. We had birds,
    : gold fish, a fine dog, rabbits, a small monkey, and a cat.

    :
    :

    :

    This latter wass a remarkably larg and beautiful
    : animal, entirely black, and sagacious to an astonishing degree. In speaking of his intelligence,
    : my wife, who at heart was not a little tinctured with supersition, made frequent allusion to the
    : ancient poplular notion, which regarded all black cats as witches in disquise. Not that she was
    : ever serious uon this point - and I mention the matter at all for no better reason that that it
    : happens, just now, to be remembered.

    :

    :
    :

    Pluto - this was the cat's name - was my favorite
    : pet and playmate. I alone fed him, and he attended me wherever I went about the house. It was
    : even with difficuly that I could prevent him from following me though the streets.

    :
    : [/code]:
    :

    Notice how there is no space between the edge of the page and the text. That`s what margin does, sets the space between elements(well, almost).

    The "*" indicates, that this setting applies to all elements. That way you don`t have to attach it to every single element separately.

    Try using code tags in this forum, that`ll maintain the proper formatting of the code:
    [leftbr]code[rightbr]
    //code...
    [leftbr]/code[rightbr]

    Good luck!
Sign In or Register to comment.