开发者

What is the -mso- prefix for in CSS?

I understand what other browser specific code names such as -moz- and -webk开发者_运维问答it- 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?


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.

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.


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.


The mso prefix in CSS is used to denote a set of style applies to the Microsoft outlook renderer.

example the below code can be used to preserve the same font size for superscript in both Gmail and outlook

style="font-size: smaller; mso-text-raise: 60%;"


To give further info about MSO (Microsoft Office programs like 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.

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.

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.

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.

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.

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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜