Remove default margin

* {
margin: 0;
}

Browsers make common-sense assumptions around margin. For example, an h1 will include more margin by default than a paragraph.

These assumptions are reasonable within the context of a word-processing document, but they might …


This content originally appeared on DEV Community and was authored by Davisson

* {
  margin: 0;
}

Browsers make common-sense assumptions around margin. For example, an h1 will include more margin by default than a paragraph.

These assumptions are reasonable within the context of a word-processing document, but they might not be accurate for a modern web application.

Margin is a tricky devil, and more often than not, I find myself wishing elements didn't have any by default. So I've decided to remove it all. 🔥

If/when I do want to add some margin to specific tags, I can do so in my custom project styles. The wildcard selector (*) has extremely low specificity, so it'll be easy to override this rule.


This content originally appeared on DEV Community and was authored by Davisson


Print Share Comment Cite Upload Translate Updates
APA

Davisson | Sciencx (2023-06-06T20:17:51+00:00) Remove default margin. Retrieved from https://www.scien.cx/2023/06/06/remove-default-margin/

MLA
" » Remove default margin." Davisson | Sciencx - Tuesday June 6, 2023, https://www.scien.cx/2023/06/06/remove-default-margin/
HARVARD
Davisson | Sciencx Tuesday June 6, 2023 » Remove default margin., viewed ,<https://www.scien.cx/2023/06/06/remove-default-margin/>
VANCOUVER
Davisson | Sciencx - » Remove default margin. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/06/06/remove-default-margin/
CHICAGO
" » Remove default margin." Davisson | Sciencx - Accessed . https://www.scien.cx/2023/06/06/remove-default-margin/
IEEE
" » Remove default margin." Davisson | Sciencx [Online]. Available: https://www.scien.cx/2023/06/06/remove-default-margin/. [Accessed: ]
rf:citation
» Remove default margin | Davisson | Sciencx | https://www.scien.cx/2023/06/06/remove-default-margin/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.