santhosh
santhosh

Reputation: 307

how to comment multiple lines of html code?

Here is my html code.

<link rel="stylesheet" type="text/css" href="/common/css/daterangepicker-bs2.css">
        <link rel="stylesheet" type="text/css" href="/common/css/multiselect.css"/>
        <link rel="stylesheet" type="text/css" href="/common/app/css/tab-styles.css">
        <link rel="stylesheet" type="text/css" href="/common/app/css/resumable.css">
        <link rel="stylesheet" type="text/css" href="/common/app/css/connectwise.css">
        <link rel="stylesheet" type="text/css" href="/app/css/chat.css">
        <link rel="stylesheet" type="text/css" href="/common/app/css/remote.css">
        <link rel="stylesheet" type="text/css" href="/common/app/css/screen.css">

I need to comment from:

<link rel="stylesheet" type="text/css" href="/common/app/css/connectwise.css">

to

<link rel="stylesheet" type="text/css" href="/common/app/css/remote.css">

Upvotes: 17

Views: 65371

Answers (4)

Shaurya Gupta
Shaurya Gupta

Reputation: 197

MultiLine comments are allowed in html using the

<!--   
    Sample multiline comment that can span
    across multiple lines within the html doc.
-->

However do note that comment within a comment i.e. nested comment is not supported in the same way in HTML

<!--   
    <!-- Such Nested comments are unsupported -->
    Sample of ineligible multiline comment that can span 
    across multiple lines within the html doc.
-->

In order to nest a comment, replace "--" with "- -". During un-nest, reverse the procedure. This is because the "--" is forbidden.

<!--   
    <!- - Such Nested comments are supported - ->
    Sample of eligible multiline comment that can span 
    across multiple lines within the html doc.
-->

Upvotes: 7

Mik3NL
Mik3NL

Reputation: 425

Use this to comment in HTML | source

<!-- Comments go here -->

So you have:

<!-- <link rel="stylesheet" type="text/css" href="/common/css/daterangepicker-bs2.css">
<link rel="stylesheet" type="text/css" href="/common/css/multiselect.css"/>
<link rel="stylesheet" type="text/css" href="/common/app/css/tab-styles.css">
<link rel="stylesheet" type="text/css" href="/common/app/css/resumable.css">
<link rel="stylesheet" type="text/css" href="/common/app/css/connectwise.css">
<link rel="stylesheet" type="text/css" href="/app/css/chat.css">
<link rel="stylesheet" type="text/css" href="/common/app/css/remote.css">
<link rel="stylesheet" type="text/css" href="/common/app/css/screen.css"> -->

EDIT: Sorry did not realize it was CSS only. Fixed my answer.

EDIT 2: I've looked into your question again and noticed that Pete removed an important question of yours, which part you wanted to cross out. The code below should be exactly what you want.

    <link rel="stylesheet" type="text/css" href="/common/css/daterangepicker-bs2.css">
    <link rel="stylesheet" type="text/css" href="/common/css/multiselect.css"/>
    <link rel="stylesheet" type="text/css" href="/common/app/css/tab-styles.css">
    <link rel="stylesheet" type="text/css" href="/common/app/css/resumable.css">
    <!-- <link rel="stylesheet" type="text/css" href="/common/app/css/connectwise.css">
    <link rel="stylesheet" type="text/css" href="/app/css/chat.css">
    <link rel="stylesheet" type="text/css" href="/common/app/css/remote.css">
    <link rel="stylesheet" type="text/css" href="/common/app/css/screen.css"> -->

Upvotes: 19

Ofer Skulsky
Ofer Skulsky

Reputation: 743

Sed comments are lines where the first non-white character is a "#." On many systems, sed can have only one comment, and it must be the first line of the script.

In HTML a comment is placed between <!-- and -->

<!--
this
is
a (multi-line)
HTML
comment
-->

Note that most scripts ignore this comment style, as it used to help hide scripts from browsers that didn't support scripts.

so in scripts you use other commenting markings.
in js for example you can use // or /* and */

// this is a one line comment in js

/*
this is a multi line comment in js
*/

If your page passes other parsing or uses other scripts, you may need to use other markings or tags

Upvotes: 0

Superpupsi
Superpupsi

Reputation: 87

In HTML you can comment multiple lines of code with:

<!--   
This is a multiline comment and it can
span through as many as lines you like.
-->

Upvotes: 2

Related Questions