Browsing through the source code of Microsoft’s sample StockTrader application, I found this snippet in all aspx files:
<meta http-equiv="Content-Style-Type" content="text/css"/>
<title>.NET StockTrader Portfolio</title>
<link rel="stylesheet" href="StockTrader.css" type="text/css" />
Why have the meta tag when the link tag says it all? Am I missing something?
The “Content-Style-Type” meta tag is used to set the default style type for the document. In practice, this doesn’t seem that useful, as most people specifically specify the style types whenever they are used, such as in the
<link>tag in your question. This particular declaration seems extra redundant as well. According to the W3:So theoretically, using “Content-Style-Type” to set the default to “text/css” is just overriding what the browser would have assumed anyway, although maybe it’s insurance against a rogue web server that might try to set something in the HTTP headers.
It’s probably generated in an enthusiastic attempt to be standards compliant.
Quick edit note: That W3 document I linked to actually claims that a document that has elements which use a style attribute without defining a default style sheet language is an incorrect document. I’ve never seen this come up as an issue in a validator before however.