Body margin randomly overridden by user agent style?


#1

Last night after just a regular reload I noticed that my entire body had a 8px margin around it. This didnt happen after any particular package was added (ive tried removing and readding any packages ive added lately to be sure) and I had made no changes to the body style. Didnt even have a body element declared as iron router takes care of that. I checked the pages source and found that the 8px was being added via “user agent stylesheet” which i guess is the browsers default stylesheet. I could easily overwrite this by adding margin 0 to the body element, but id like to know why this suddenly happened and this override wasnt required before?

When i noticed it i was playing with ._uihooks to add fadein-fadeout transitions to the templates when they’re being rendered. Im not sure if this could/how it would affect the body styling but i even commented all that code out just incase and the body still had the margins. Any ideas?


#2

Were you previously using any packages or stylesheets that were overriding it? If you’re getting the default browser styles it probably means nothing is overriding it?


#3

That’s just the default if you do not override it. It’s how your browser rolls.
So the question is rather “who was removing that at first” and not “why do I have it now”.


#4

Not that i know of. I removed and readded any packages that even ‘might’ have a chance at affecting it, and nothing changed.

Thats whats odd. The latest package i installed was animate.css, but removing that had no effect, and actually i dont think the margins appeared until after i had already had the package for awhile. I was trying to use the ._uihooks to animate templates on render. From what i can remember, when i saved the files after adding the transitions in the hooks, meteor reloaded and the margins appeared and the page was messed up from the transitions. Removing all the transitions and hooks fixed the page but the margin stayed.

My ‘theory’ or best explanation would be that when it tried firing the hooks it somehow ‘uncovered’ the user agent defaults. Note i was not using any kind or normalize before this.

This isnt a problem to fix of course but its interesting as to why it happened.