HTML Guides for office
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The xmlns:msdt attribute is a Microsoft Office namespace declaration, and HTML doesn't allow prefixed namespace declarations on any element.
In XML, xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" binds the prefix msdt to Microsoft's data types namespace. Office uses it to give each document property a type, with attributes like msdt:dt="string". The HTML parser doesn't process namespace declarations, so it reads xmlns:msdt as an unknown attribute that happens to have a colon in its name. The only namespace attribute HTML accepts is xmlns, with the exact value http://www.w3.org/1999/xhtml. The validator reports xmlns:msdt on any element, <html> included.
The declaration usually comes with a block of Office document properties, which SharePoint and Office write into the pages they save. The block has its own <html> and <head> tags, often with xmlns:mso next to xmlns:msdt, and keeps the properties inside a conditional comment that browsers treat as a plain comment. When the block ends up in the middle of a page, the validator also reports the stray <html> and <head> tags. Browsers drop the extra <head> tags and copy the attributes of the extra <html> tag onto the page's real <html> element.
Remove the whole block: the extra <html> and <head> tags and the comment between them. If xmlns:msdt sits on the page's own <html> tag instead, delete just the attribute. Browsers don't use the declaration or the properties, so the page looks and works the same without them. If the block comes from a SharePoint page layout, remove it from the layout so every page that uses it gets the fix. If it comes from content pasted into a web part, edit that content.
Invalid example
<div class="page-content">
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:ContentType msdt:dt="string">Page</mso:ContentType>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
<p>Our offices are open Monday to Friday.</p>
</div>
Valid example
<div class="page-content">
<p>Our offices are open Monday to Friday.</p>
</div>
These mso- prefixed properties are most commonly introduced when content is copied and pasted from Microsoft Word or other Office applications into an HTML editor. Microsoft Office generates heavily styled HTML with dozens of proprietary CSS properties designed to preserve the document's formatting when rendered back in Office products. While browsers silently ignore these unknown properties, they clutter your markup, inflate file size, and violate web standards.
This is a problem for several reasons. First, these properties have no effect in any web browser — they are purely artifacts of Microsoft's internal rendering engine. Second, they significantly bloat your HTML, sometimes doubling or tripling the size of the markup. Third, they make your code harder to read and maintain. Fourth, they can cause issues with automated tools, linters, and content management systems that expect valid CSS. Finally, in the context of HTML email development, while mso- properties are sometimes intentionally used to target Microsoft Outlook's rendering engine, they should not appear in web pages intended for browsers.
How to Fix
- Identify the source. Check if the content was pasted from Microsoft Word or another Office application. This is the most common origin.
- Remove all
mso-properties. Delete every CSS declaration that starts withmso-. They serve no purpose in a browser context. - Replace with standard CSS if needed. Some
mso-properties have standard CSS equivalents. For example,mso-margin-top-altcan be replaced withmargin-top, andmso-bidi-font-weightcan be replaced withfont-weight. - Use a paste-as-plain-text workflow. When copying from Word, paste as plain text first (Ctrl+Shift+V in many editors), then apply formatting using your own CSS.
Examples
❌ Incorrect: HTML with Microsoft Office properties
<p style="mso-spacerun: yes; mso-fareast-font-family: 'Times New Roman'; margin-bottom: .0001pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-bidi-font-weight: bold; line-height: normal;">
This text was pasted from Microsoft Word.
</p>
<style>
.content {
mso-fareast-font-family: "Calibri";
mso-bidi-font-family: "Times New Roman";
font-family: Arial, sans-serif;
mso-line-height-rule: exactly;
line-height: 1.5;
}
</style>
✅ Correct: Cleaned-up HTML with only standard CSS
<p style="margin-bottom: 0; margin-top: auto; font-weight: bold; line-height: normal;">
This text was pasted from Microsoft Word.
</p>
<style>
.content {
font-family: Arial, sans-serif;
line-height: 1.5;
}
</style>
Common mso- properties and their standard replacements
mso- Property | Standard CSS Equivalent |
|---|---|
mso-margin-top-alt | margin-top |
mso-margin-bottom-alt | margin-bottom |
mso-bidi-font-weight | font-weight |
mso-bidi-font-style | font-style |
mso-bidi-font-size | font-size |
mso-fareast-font-family | font-family (use a standard font stack) |
mso-line-height-rule | No equivalent needed — remove it |
mso-spacerun | No equivalent needed — remove it |
mso-tab-count | No equivalent needed — remove it |
Many mso- properties (like mso-spacerun and mso-tab-count) control behaviors specific to Microsoft's rendering engine and have no CSS equivalent at all. These can simply be deleted without any replacement. If your content originally came from Word, it's often best to strip all formatting and restyle the content from scratch using your own clean CSS.
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries