简体   繁体   中英

Content type beside text/html

You probably all know the tag:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I was wondering what values are there beside text/html for the content attribute?

Common ones include:

  • text/xml
  • application/json
  • image/jpeg

Comprehensive list here : http://www.freeformatter.com/mime-types-list.html#mime-types-list

The only content type values you'd want to use for HTML are text/html and application/xhtml+xml for XHTML.

See also: Valid content-type for XML, HTML and XHTML documents

This is the long winded HTML4 way of writing the meta tag. In HTML5 it's much simpler.

New:

<meta charset="UTF-8">

Since you can technically pass just about any form of data to the web browser the

content="text/html

Was meant to tell the browser that is was going to be displaying text/html.

Meta tags are used to describe data about the web page. The data is not displayed, however it can be used for several things. Example supplying and author, giving a description, keywords, and even a document refresh interval.

HTML meta tag

Also....

Using Meta Tags in HTML: Some Basics and Best Practices

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM