This is a sample:

<html>
<head>
    <title>word test</title>
</head>
<body>
    <div style='position: absolute; width: 30px; height: 50px; top: 100px; left: 20px; border-color: black; border-width: 1px; border-style: solid;'>
        <p>Hello!</p>
    </div>
</body>
</html>

Save it as "word.doc" and open in MS WORD.

Absolute position don't work!

Div is rendered on the top of document and with 100% width. Why? I can't use a html tables.

Version on ms word: 2003

link|improve this question
Office 2007 - burden of my life (especially Outlook 2k7!) – Neurofluxation May 27 '10 at 9:11
1  
Why are you using HTML to generate a Word document? Office and HTML are like fire and ice. – RoToRa May 27 '10 at 9:48
feedback

migrated from stackoverflow.com May 28 '10 at 18:47

This question came from our site for professional and enthusiast programmers.

2 Answers

You can find a full list of Word 2007's supported CSS here:

http://msdn.microsoft.com/en-us/library/aa338201%28office.12%29.aspx

Yes, it's shockingly poor but would you expect anything else from Microsoft's Office team?

Here's a quick reference list of CSS2 that you can't use:

  • azimuth
  • background-attachment
  • background-image
  • background-position
  • background-repeat
  • border-spacing
  • bottom
  • caption-side
  • clear
  • clip
  • content
  • counter-increment
  • counter-reset
  • cue-before, cue-after, cue
  • cursor
  • display
  • elevation
  • empty-cells
  • float
  • font-size-adjust
  • font-stretch
  • left
  • line-break
  • list-style-image
  • list-style-position
  • marker-offset
  • max-height
  • max-width
  • min-height
  • min-width
  • orphans
  • outline
  • outline-color
  • outline-style
  • outline-width
  • overflow
  • overflow-x
  • overflow-y
  • pause-before, pause-after, pause
  • pitch
  • pitch-range
  • play-during
  • position
  • quotes
  • richness
  • right
  • speak
  • speak-header
  • speak-numeral
  • speak-punctuation
  • speech-rate
  • stress
  • table-layout
  • text-shadow
  • text-transform
  • top
  • unicode-bidi
  • visibility
  • voice-family
  • volume
  • widows
  • word-spacing
  • z-index
link|improve this answer
feedback

Probably because Microsoft Word uses its own renderer which sucks.

An article from 2007 says...

No support for float or position

(this should apply to you because your version is 2003)

So you are out of luck. Unfortunately, table based layouts are still common in HTML emails because of this reason.

link|improve this answer
Ok. I have collection of blocks. I know x, y, width, height of each block. Can I convert it to table design? Blocks don't has children. – Tim May 27 '10 at 9:13
feedback

Your Answer

 
or
required, but never shown