Appendix H. MIME Media Types

You have seen the type attribute used throughout this book on a number of elements, the value of which is a MIME media type.

MIME (Multipurpose Internet Mail Extension) media types were originally devised so that e-mails could include information other than plain text. MIME media types indicate the following things:

  • How the parts of a message, such as text and attachments, are combined into the message

  • The way in which each part of the message is specified

  • The way the items are encoded for transmission so that even software that was designed to work only with ASCII text can process the message

As you have seen, however, MIME types are not just for use with e-mail; they were adopted by web servers as a way to tell web browsers what type of material was being sent to them so that they could cope with that kind of file correctly.

MIME content types consist of two parts:

  • A main type

  • A sub-type

The main type is separated from the sub-type by a forward slash character—for example, text/html for HTML.

This appendix is organized by the main types:

  • text

  • image

  • multipart

  • audio

  • video

  • message

  • model

  • application

For example, the text main type contains types of plain-text files, such as:

  • text/plain for plain text files

  • text/html for HTML files

  • text/rtf for text files using rich text formatting

MIME types are officially supposed to be assigned and listed by the Internet Assigned Numbers Authority (IANA).

Many of the popular MIME types in this list (all those that begin with "x-") are not assigned ...

Get Beginning Web Programming with HTML, XHTML, and CSS, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.