View Single Post
Old 11-01-2015, 11:54 AM   #2
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,830
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Arios View Post
Hi guys,

Just by curiosity: in CSS is it better to use, for example:

Code:
* {
    margin: 0;
    text-indent: 0;
    padding: 0;
}
or put it in the the <body>:

Code:
body {
    margin: 0;
    text-indent: 0;
    padding: 0;
}
I mean, is it more in the semantic line or relevant/effective to use one instead of the other?
They are not the same. With

Code:
body {
    margin: 0;
    text-indent: 0;
    padding: 0;
}
only the "body box" will have those properties but with

Code:
* {
    margin: 0;
    text-indent: 0;
    padding: 0;
}
all selectors (p, div, blockquote, h1, h2, etc, etc.) will have margin:0, padding:0 and text indent:0. With the first option, for example if you don't define styles for the h1 tag, <h1> will have default values (that is, will have margins different from 0) but with the second option, <h1> wil have null margins, padding and indent. In short: with the second option, you'll set as default margin:0; padding:0 and text-indent:0 for all selectors and you'll be forced to establish values for them (if you want others values for those properties).

None of those options is wrong, to use one or the other will depend of what you want to do

Regards
Rubén

Last edited by RbnJrg; 11-01-2015 at 11:59 AM.
RbnJrg is offline   Reply With Quote