Does tailwind reset padding, margin, box-sizing?

Does tailwindCSS add these out of the box? I learned I should always add these styling to global css. After adding tailwind I added these to index.css but nothing happened. But I also didn't find in the code if it's added out of the box?
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
8 Replies
MarkBoots
MarkBootsβ€’2mo ago
It's not something you allways need to do, or something that will allways have effect. box-sizing: border-box is usefull when defining element sizes without having to worry about borders and padding sizes. If you don't set sizes, you won't notice a difference. the reset of padding and margin probably is not neccessary because of the individual styling (with tw classes) on your elements
birdy
birdyβ€’2mo ago
Thank you very much. I found CSS difficult so I remember that, as rule number 1 πŸ˜…
13eck
13eckβ€’2mo ago
One important thing to keep in mind with nuking both padding and margin is that when you actually need it you'll have to re-add it where it belongs. A good example is lists: they use padding so you can see the bullet point/number. Removing padding from all elements is kinda silly. Instead, only change what you need to change. As for margin…if you remove it from everything you'll need to re-add it to almost every block-level element. Otherwise you won't have any space between paragraphs, headers, etc. The box sizing is an important one to always add as it makes the elements work as we think they should (you can thank Microsoft and Internet Explorer for why it's not the default πŸ™„ ). See the example pen: https://codepen.io/c__beck/pen/LYKEvLO
Kevin Powell
Kevin Powellβ€’2mo ago
(you can thank Microsoft and Internet Explorer for why it's not the default πŸ™„ ).
Opposite in fact. IE5 had the default to how border-box works, but that went against the spec (which was a bit vague at the time). CSS2 spec made it more explicit, and IE6 fell in line with the other browsers. I just did a bunch of historic research into this for something, so it's front of mind for me right now πŸ˜…
13eck
13eckβ€’2mo ago
Oh, the spec was what was "wrong"? I always thought MS was in the wrong b/c, y'know, MS :p
Kevin Powell
Kevin Powellβ€’2mo ago
Yup! And MS also invented Grid, so they did do some good things along the way πŸ˜„
13eck
13eckβ€’2mo ago
TIL, thanks for the info, @Kevin ! Can't wait for your "History of CSS" video that you're working on lol
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Preflight - Tailwind CSS
An opinionated set of base styles for Tailwind projects.
Want results from more Discord servers?
Add your server