0

i'm a fresh in css, my friend suggest me to add below css to every page,

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    font-family: arial,sans-serif;
}

why we need do that?

Jack Zhang
  • 2,534
  • 5
  • 25
  • 34
  • You don’t have to do that. If you ask your friend and he gives you a reason, then there might be a constructive question to be answered (namely whether the reason given is technically sound). – Jukka K. Korpela Apr 19 '13 at 12:57

3 Answers3

3

to reset all settings, that might vary among different browsers

examples: http://meyerweb.com/eric/tools/css/reset/

jancha
  • 4,916
  • 1
  • 24
  • 39
2

as ExP already explained you should not use this, but a css reset can be very helpful as some browsers display certain elements different from each other (just like jancha said).

But I prefere normalize.css - it does not change the overall behavior of your elements but unifys them as best as possible.

Just load the normalize.css before you load your own css file and everythings fine! :)

http://necolas.github.io/normalize.css/

xate
  • 56
  • 4
0

Actually, you probably don't want to add this to every page.

It makes the font size and margins of all elements look the same. Headings would look exactly like paragraphs without even any space between them...

Elmar Peise
  • 14,014
  • 3
  • 21
  • 40
  • different browsers have different predefined stylings. so with a reset stylesheet (the above one is not the best idea) you have a clean start. and you are forced to set the styles your self which ensure that the page looks the same in every browser/platform. sure using only this will have your described result, but reset script are set at the beginning, and then your styling is followed. – t.niese Apr 19 '13 at 09:28