Browsers usually set different default styles for elements. Users can also override the defaults using custom stylesheets.
I often override these default styles using my own styles, e.g.:
* {padding:0; margin:0; }
However, I wish to respect the default stylesheet for certain element attributes, e.g. the <body>‘s default padding and margin. I tried:
* { padding:0; margin:0; }
body { padding:default; margin:default; }
But it doesn’t work. Neither does initial.
Is there a way to solve this problem by selecting all elements but excluding <body>?
Since everything that is displayed in the viewport consists of
<html>,<body>and<body>‘s contents by default, you can just selecthtml, and all ofbody‘s descendants:defaultdoesn’t work because there is no such keyword.initialdoesn’t work because the initial margins are 0. It is not possible to reset a property to its browser-given default value after you have changed it using CSS.