17

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

3
  • What do you want? can you please explain? Commented Nov 6, 2017 at 14:03
  • <!-- --> should work over multiple lines? Commented Nov 6, 2017 at 14:04
  • I also want to comment out multiple lines of HTML but I have always found that adding <!-- and --> at the start and end of the multi-lined code never works. Only the first line gets commented out, the rest are still active if somewhat not properly functional. Ideas anyone? Commented Feb 2, 2021 at 4:55

3 Answers 3

20

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"> -->
Sign up to request clarification or add additional context in comments.

3 Comments

You are correct but i need to comment those lines at a time through salt stack.
Correct me if I'm wrong but for saltstack, can't you simply use a # to comment the lines? Maybe {# comment here #} works? Or simply # This is a comment
We can use # in salt stack but we can't use # for comment HTML code. My requirement is, i need to comment those lines (<!-- code -->) through salt or sed
8

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

Comments

-1

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.