commenting-out style y or n?

windows

Guest
I think this web-site is great for learning HTML, CSS and JS,...all of which I am relatively new at so I have many questions some which may be stupid but nothing ventured nothing gained, right?

My question now is in reference to the use of the comment tags when style is placed into the <head> tag. Namely is this a required thing. structure:
<!--<style>yada..CSS..yada</style>-->

I have not used it (i.e. no comments) and gotten good results which, when I thought I was correcting for its absence, the page parsed surprisingly different (no back-ground color and different font-sizes). I have read that "commenting head-style" serves to prevent older browsers from displaying the style code, but i think this must now be changed. So should the style code be commented or not??
__JHG<!--<style>yada..CSS..yada</style>-->All browsers should ignore any tags between the HTML comments. So, what you posted should just be one big comment, and ignored by any well-behaved browsers, including the ones that support CSS. Probably this is what you meant (at least it has some chance of working):<style ... >
<!--
(some style definition)
-->
</style>

I think you are confused. There were known problems with some older browsers showing things between script tags, so the advice was to use this:<script ... >
<!--
(all the script stuff)
//-->
</script>which makes all the code an HTML comment, and prevents literal characters from screwing up the real HTML.

Since there is nothing in the style structure that looks like HTML, it should never have been a problem. I think that someone thought it was a good idea and nobody ever questioned it.>There were known problems with some older browsers showing things between script tags,

Thanks Gil Davis for clarifying what should be an elementary issue for the novice. I read about the older browsers showing the code but was unsure of the order-syntax or if anyone needs to be concerned with very very old browser behavior.

I will follor your order-syntax from now on.

__ Jim
 
Back
Top