Grow your CSS skills. Land your dream job.

How to put guide comments inside of HTML files?

  • # March 31, 2013 at 4:44 am

    Hello!

    What is the best way of putting guide comments inside of an HTML file?

    I mean how should I put it to have a well organized file?

    thanks!

    Alireza.M

    # March 31, 2013 at 5:27 am

    Comments in HTML can be entered with ``

    Generally though it’s going to add to the page weight so they should be used sparingly.

    Perhaps just to mark the start / end of divs / sections.

    # March 31, 2013 at 6:24 am

    I would suggest commenting the crap out of your code (which ever language it may be), however, like Paulie_D mentioned, it does at weight to your page. Have a copy just for you which is commented, and whatever you put into production just strip out the comments.

    Most of the time (lol…) you dont really need to comment out html or css because developers can read it just fine and understand what you are doing (that only goes for somewhat well written html). Now for javascript, comments are nice because it allows other devs to reference variables, functions, etc.

    # April 1, 2013 at 1:40 pm

    Thanks!

    # April 1, 2013 at 3:59 pm

    You can use php comments to comment the ‘html’ without adding weight to the page. (assuming you are using php to generate the html)

    < ?php // comment here ?>

    or

    < ?php /* multiline comment
    here */ ?>

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".