Results 1 to 3 of 3

Thread: commenting-out style y or n?

  1. #1
    Join Date
    Apr 2003

    Post commenting-out style y or n?

    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:

    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??

  2. #2
    Join Date
    Nov 2002
    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)
    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)
    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.

  3. #3
    Join Date
    Apr 2003
    >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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center