user1322720
user1322720

Reputation:

Do external style sheets need to have .css ending?

I'd like to dynamically create my style sheet in PHP. So (without using .htaccess to tell the server to parse .css as PHP) my style sheet would end in .php:

<link rel="stylesheet" type="text/css" href="styles.php">

Does that work? Is it within specification?

Upvotes: 0

Views: 96

Answers (1)

D. Melo
D. Melo

Reputation: 2239

You should use the text/css mime type to the output of that php file, so the browser can understand better. The extension is not a requirement.

<?php
header('Content-type: text/css');
?>

http://www.dynamicdrive.com/forums/showthread.php?21617-Dynamic-external-js-scripts-and-css-stylesheets-with-PHP

Upvotes: 3

Related Questions