One of the banes of content management is the style inconsistencies introduced when someone does a copy and paste from MS Word directly into the rich text editor of their CMS, introducing different font families, line spacing and indentation. One line of defense against this is WordPress’ TinyMCE editor’s “Paste from Word” button that content authors should be trained to use in an ideal world.
But, in the real world, training is spotty, often forgotten and authors will still paste directly from Word. Compounding this is that the editor currently needs to be expanded to even see this functionality. Also, the disadvantage of pasting plain text is that authors lose formatting such as bold and italics, which is frustrating. In an effort to combat this, I’ve come up with the following defensive CSS styles that I will add to all future sites I deliver to clients.
.MsoNormal {
margin: [normal <p> margins here] !important;
text-indent: 0 !important;
}
.MsoNormal span, font {
font-size: inherit !important;
font-family: inherit !important;
color: inherit !important;
}
Notes:
- the
.MsoNormal
class is, in my experience, always attached to a<p>
element. If you are setting margins specifically on the<p>
element, you cannot tell it to inherit, because there’s nothing to inherit from. Instead, match the margin styling on the appropriate<p>
element