Jump to content

saila.com

Online media matters

In older browser’s, my JavaScript/style sheets are being displayed as text.

This is an easy fix. Just wrap the content of your JavaScript/style sheets with a comment tag:

<script> (or <style>)
<!--
  content
//-->
</script> (or </style>)

In order for the comments to validate in XHTML, you will have to do comment the block like this for JavaScript:

<script type="text/javascript"><!--//--><![CDATA[//><!--
  content
//--><!]]></script>

and this for style sheets:

<style type="text/css"><!--/*--><![CDATA[/*><!--*/
  content
/*]]>*/--></style>

The last two solutions were first discovered by Andrew Clover.