How to select * but exclude <body>? Or set the default <body> style?

Browsers usually set different default styles for elements. Users can also override default values ​​using custom stylesheets .

I often override these default styles using my own styles, for example:

* {padding:0; margin:0; }

However, I want to respect the default stylesheet for certain element attributes, for example. <body>default filling and margin. I tried:

*    { padding:0;       margin:0;       }
body { padding:default; margin:default; }

But that will not work. Also does not exist initial.

Is there a way to solve this problem by selecting all items but excluding <body>?

+5
5

, , <body>?

, , <html>, <body> <body> , html body:

html, body * { margin: 0; padding: 0; }

default , . initial , 0. reset , CSS.

+10
html, head, head *, body * { }
+2

<html> <body>:

html, body * {padding:0;margin:0;}
+2

body *.

body *{padding:0;margin:0;}
+1

0, . CSS Reset, , .

   * {
     padding:0;
     margin:0;
   }

   body, html {
     padding: 10px;
   }

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

0
source

All Articles