Embedding a div container with an inline style attribute is not the way to do it. Your problem of WordPress stripping out certain attributes is a side effect of your real problem, not the problem itself.
- You shouldn’t be styling things inline, this isn’t 1997, use CSS classes instead
- You shouldn’t need to put custom markup in a post
If you do need extensive custom markup that changes the layout or styling of a post/page, you should apply one of the following:
- use a custom page template
-
implement a shortcode to wrap around the content, e.g.:
[bluebox]This text is in a fancy blue box[/bluebox]
Disabling html filtering on non-admins doesn’t solve your issue, it introduces new security issues, and makes your content hard to edit for the end user ( and yourself when you come back in a few months and have forgotten things ).
Finally, just because a wysiwyg editor generated the markup, doesn’t mean it has to match it. If a more sensible way of implementing styling and html is available, rewrite it. Auto-generated code won’t be the best way of writing webpages, and if your wysiwyg editor is giving you inline style attributes, then I wouldn’t trust it.