CSS 中的 -mso- 前缀是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7507002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:40:45  来源:igfitidea点击:

What is the -mso- prefix for in CSS?

cssvendor-prefix

提问by Joseph

I understand what other browser specific code names such as -moz- and -webkit- are used, the former for mozilla and the later for chrome and safari, but what is -mso- exactly? It stands for Microsoft Office, but a web page is never brought up in that program, is it?

我了解使用了哪些其他浏览器特定代码名称,例如 -moz- 和 -webkit-,前者用于 mozilla,后者用于 chrome 和 safari,但 -mso- 究竟是什么?它代表 Microsoft Office,但该程序中永远不会显示网页,是吗?

回答by llovelett

Your example code:

您的示例代码:

<style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style>

Looks like what would happen if someone copied and pasted text from a Microsoft Word Document into a WYSIWYG editor in a content management system.

看起来如果有人将 Microsoft Word 文档中的文本复制并粘贴到内容管理系统中的 WYSIWYG 编辑器中会发生什么。

MS Word puts in a ton of nasty code that is not needed. It's better to tell your content authors to paste in plain text instead of from MS Word.

MS Word 放入了大量不需要的讨厌的代码。最好告诉您的内容作者粘贴纯文本而不是 MS Word。

回答by Jon

Mso- attributes are used for coding HTML Emails. Since Outlook 2007, Microsoft decided to use the Word rendering engine in their email client. This creates a lot of quirks in how HTML Email shows up in Outlook, thus the need to use mso- attributes in HTML.

Mso- 属性用于编码 HTML 电子邮件。自 Outlook 2007 起,Microsoft 决定在其电子邮件客户端中使用 Word 渲染引擎。这在 HTML 电子邮件在 Outlook 中的显示方式方面产生了很多怪癖,因此需要在 HTML 中使用 mso- 属性。

回答by Lifes

To give further info about MSO (Microsoft Office programs like MS Word)...

要提供有关 MSO(Microsoft Office 程序,如 MS Word)的更多信息...

As a new webmaster (12 yrs ago, now) who did not know HTML, I took over a website. And I added 6 more over a few years. Took me several years to learn what the WYSIWYG editor (old Frontpage 2000) did with code. After learning in-line styles, I started learning beginner CSS. But it's been slow; I'm finally working with an External Style Sheet.

作为一个不懂 HTML 的新网站管理员(12 年前,现在),我接管了一个网站。几年后我又增加了 6 个。我花了几年时间学习 WYSIWYG 编辑器(旧版 Frontpage 2000)对代码的处理。在学习了内联样式之后,我开始学习初级 CSS。但它很慢;我终于在使用外部样式表了。

Then, several years ago, I decided to truly clean up my code--I started with the 6 webs because I knew those the best. Now, I am working on the 7th and hardest site, the one I inherited. It has code from Access, Word, Spreadsheets, Frontpage Tables, etc.

然后,几年前,我决定真正清理我的代码——我从 6 个网络开始,因为我最了解那些。现在,我正在第 7 个也是最难的站点上工作,这是我继承的站点。它有来自 Access、Word、Spreadsheets、Frontpage Tables 等的代码。

A variety of MSO tags are throughout the site. I look up every piece so I know what it did on my site. Typically, I get rid of the code even if removing it messes up the page.

各种 MSO 标签遍布整个站点。我查找每一件作品,所以我知道它在我的网站上做了什么。通常,即使删除代码会弄乱页面,我也会删除它。

On your example:

在你的例子中:

<style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style>

This is a style for a 'normal' Table. It gives row; column size; padding & margins for cells; and then styles for paragraphs. The Language is redundant since that should be in your META section. Table info and FONT should be in your External CSS.

这是“普通”表格的样式。它给出行;列大小;单元格的填充和边距;然后是段落的样式。语言是多余的,因为它应该在您的 META 部分中。表格信息和字体应该在你的外部 CSS 中。

Once you check your META tag, and Ext. CSS, delete the entire style. NOTE: However, this means your table might look weird until you redo the code. Check your CSS for your Table styles and apply one.

一旦你检查了你的 META 标签和 Ext。CSS,删除整个样式。注意:然而,这意味着在您重做代码之前,您的表格可能看起来很奇怪。检查您的表格样式的 CSS 并应用一个。

It's very unnerving to tear apart a webpage or website. Look up the item on Google... then, when you know what that tag does, be brave and delete the MSO tag.

撕开网页或网站是非常令人不安的。在 Google 上查找该项目...然后,当您知道该标签的作用时,请勇敢地删除 MSO 标签。

Can you delete just part? Usually, yes.

可以只删一部分吗?通常,是的。

Can you leave part? If you don't know what it does, yes you can keep a piece of code while you research what it means. Just use Search to refind the code piece.

你能留下部分吗?如果您不知道它的作用,是的,您可以在研究它的含义时保留一段代码。只需使用搜索来重新查找代码段。