CSS Styles

Whenever possible, Microsoft Office saves and loads cascading style sheets (CSS) styles to preserve formatting.

CSS Styles and Office Styles

CSS creates shared text formatting styles by defining styles in the Style element and applying styles using the class attribute. When Office reads in an HTML document with styles applied through the class attribute, it will attempt to create equivalent named styles for Microsoft Word and Microsoft Excel.

When Word and Excel write out a document to HTML, they will preserve named styles by creating style definitions in the style element and applying those styles with the class attribute whenever possible. 

CSS styles that are applied to paragraphs will be directly imported as named paragraph styles. If a style is applied to a Span element, it will be imported as a character style.

External Style Sheets

Microsoft Word will attempt to read in HTML documents that have external CSS stylesheets, but it will not write them back out again. The style values of multiple style sheets will be merged whenever possible. However, when Office writes out HTML, it does not create external CSS stylesheets.

The style values of multiple style sheets will be merged whenever possible. For example, if one style sheet defines a style named mystyle as italic and another sheet defines a style also named mystyle as underlined, when imported into Office the combined mystyle value will be italic and underlined. Conflicting values will be resolved in favor of the last linked style sheet.