How Is MS Word related to HTML and CSS?

  • Thread starter christian0710
  • Start date
  • Tags
    Css Html
In summary, MS Word has the ability to transform its internal format to (approximate) HTML, but the resulting HTML can be very complicated and may not display correctly in browsers. The file format for modern versions of Word is based on XML, making it easier to convert to HTML. However, the formatting in Word may not directly translate to simple HTML tags, and it is recommended to use a simpler program for creating ebooks. Microsoft has had issues with format conversion in the past between different office suites.
  • #1
christian0710
409
9
Just wondering: When i write a book in MS Word and save it as a webpage file (html) It seems that all the formatting i chose in MS Word (bulletons, indents, headings) perfectly translates to HTML and CSS, so just wondering Is HTML and CSS built into MS Word? Does MS Word work like a BROWSER, such that when i choose Heading 1, it's actually putting <h1> tags around the text and displaying it like a browser?
 
Computer science news on Phys.org
  • #2
No, MS Word knows how to transform its different internal format to (approximate) HTML.
 
  • Like
Likes christian0710
  • #3
If you are using a modern version of Word (the one that saves files with a docx extension), the file format is based on XML (see https://en.wikipedia.org/wiki/Office_Open_XML). This means that there is a relatively small difference between the Microsoft format and HTML. You can see for yourself: Create a copy of a .docx file you want to inspect, change the extension to .zip and extract the contents.
 
  • Like
Likes christian0710
  • #4
mfb said:
No, MS Word knows how to transform its different internal format to (approximate) HTML.
I
Thank you. Does this docx --> HTML engine that word introduced have a name?
 
  • #5
Svein said:
If you are using a modern version of Word (the one that saves files with a docx extension), the file format is based on XML (see https://en.wikipedia.org/wiki/Office_Open_XML). This means that there is a relatively small difference between the Microsoft format and HTML. You can see for yourself: Create a copy of a .docx file you want to inspect, change the extension to .zip and extract the contents.

Wau that's a lot of files, thank you for the demonstration, so word can convert from Words coding language to XML, and today to HTML.
So what is the inherint/original coding language that word uses for formatting fx heading 1, body text etc?
 
  • #6
christian0710 said:
Just wondering: When i write a book in MS Word and save it as a webpage file (html) It seems that all the formatting i chose in MS Word (bulletons, indents, headings) perfectly translates to HTML and CSS, so just wondering Is HTML and CSS built into MS Word? Does MS Word work like a BROWSER, such that when i choose Heading 1, it's actually putting <h1> tags around the text and displaying it like a browser?
A word of warning:
Although MS Word will save files in an HTML format, it makes very complicated HTML. In general, something like Heading 1 will not translate into a simple <h1>. In fact, nothing in those files is simple. Those saved HTML files work fine when opened in Word, but may not work well when opened in a browser. Even some versions of the Explorer browser. will not display it correctly. Just last month, I had to rewrite a saved MS Word HTML file. It worked fine on my browser, but after I distributed it, I found out that other people could not see the figures. I had to spent a couple of days editing the file by hand to simplify the HTML and make it usable.

PS. Word has 2 options for saving in HTML format. On saves everything in a single file and another saves many parts in a subdirectory. My impression is that the single-file option is not as standard as the option with the subdirectory.
 
Last edited:
  • Like
Likes christian0710
  • #7
FactChecker said:
A word of warning:
Although MS Word will save files in an HTML format, it makes very complicated HTML. In general, something like Heading 1 will not translate into a simple <h1>. In fact, nothing in those files is simple. Those saved HTML files work fine when opened in Word, but may not work well when opened in a browser. Even some versions of the Explorer browser. will not display it correctly. Just last month, I had to rewrite a saved MS Word HTML file. It worked fine on my browser, but after I distributed it, I found out that other people could not see the figures. I had to spent a couple of days editing the file by hand to simplify the HTML and make it usable.
Do you know if kindle translates Word nicely from word? I did view a HTML word file and i see your point, maybe writing ebooks in HTML and CSS is the way to go, i just need to find out which subset of HTML and CSS is allowed on kindle devices.
 
  • #8
christian0710 said:
Do you know if kindle translates Word nicely from word? I did view a HTML word file and i see your point, maybe writing ebooks in HTML and CSS is the way to go, i just need to find out which subset of HTML and CSS is allowed on kindle devices.
I have no experience with kindle. I seriously doubt that it would be able to display a saved Word HTML. I recommend that you use something where you can control the generated HTML and keep it as simple as possible. I have always ended up using a programmers editor like gvim to directly edit HTML, but I hope you can find something better.
 
  • Like
Likes christian0710
  • #9
Word is notorious for format conversion problems. You may not know this, but Microsoft actually once had two different office suites: Office and Works. The dumbest thing? They couldn't understand each other's formats!
 
  • Like
Likes christian0710

1. What is MS Word and how is it related to HTML and CSS?

MS Word is a word processing software developed by Microsoft. It is not directly related to HTML and CSS, but it can be used to create HTML documents and style them using CSS.

2. Can I use MS Word to code in HTML and CSS?

Yes, you can use MS Word to create HTML documents and write CSS code. However, it is not the most efficient or recommended way to code in HTML and CSS as MS Word is primarily designed for creating documents and not coding.

3. How do I save a document in MS Word as an HTML file?

To save a document in MS Word as an HTML file, go to "File" then "Save As" and choose "Web Page (.htm, .html)" from the "Save as type" dropdown menu. This will save the document as an HTML file that can be opened in a web browser.

4. What is the difference between MS Word and HTML?

MS Word is a word processing software used for creating documents, while HTML is a markup language used for creating web pages. MS Word is more visually-oriented, while HTML is more focused on structure and content of a webpage.

5. Can I use CSS to style a document created in MS Word?

Yes, you can use CSS to style a document created in MS Word. However, the styling options may be limited compared to a document created in a web development environment using HTML and CSS.

Similar threads

  • Computing and Technology
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Computing and Technology
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
957
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
16
Views
2K
  • Computing and Technology
Replies
6
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
  • Computing and Technology
Replies
5
Views
4K
  • Programming and Computer Science
Replies
5
Views
975
Back
Top