Search code examples
phpstylesheet

embed styles in <style> tags, or use <link> tags?


I have a php function that I use to write out my <link> tags.

Now I thought about this and,

it would be just as easy to modify the function so it will write out a

<style>
//stylesheet contents here
</style>

block.

can anyone please tell me why this is/is not a good idea.

So far it seems 1 for 1.

Pro: You have less requests to the server.
Con: The stylesheet will not be cached.

What do you think?


Solution

  • Reading the css with php might take more processing on the server than just showing the css url in the <link> tag (I guess you're using file_get_contents()).