Skip to main content
Inspiring
December 11, 2017
Answered

Inline [Partial] Comment

  • December 11, 2017
  • 2 replies
  • 1043 views

Suppose I would like the server to ignore only a portion of a line of html. What are the symbols for that, if any? I seem to recall past use of those, but would prefer not to embark on a trial-and-error experimentation to try to recover them.

With thanks in advance,

and best holiday wishes,

jwc

    This topic has been closed for replies.
    Correct answer Jon Fritz

    Jack  wrote

    Right, but please see my reply to Nancy. I wondered if there was a character-set that would allow the server to ignore just a portion of a line of html, as in, for example:

         The quick brown fox jumped <<under>>over the lazy dog’s back,

    where all content between << . . . >> would be ignored.

    Is there an ‘ignore' character set, that one can use ‘inline’, in place of ‘<<' . . . '>>’ above?

    Best,

    jwc


    Either of the options I mention will work, with html comments...

    <div>
    <p>Some text goes here<!-- this is commented out--> and the rest goes here</p>
    </div>
    <!-- <div>this div is hidden</div> -->

    (which displays exactly as above for someone viewing the source) or with php comments...

    <div>

    <p>Some text goes here<?php /* this is commented out */ ?> and the rest goes here</p>

    </div>

    <?php /* <div>this div is hidden</div> */ ?>

    Which I like better, because it displays as...

    <div>
    <p>Some text goes here and the rest goes here</p>

    ...when the source is viewed. Nobody can see what code, portion of a line, block of text or notation you're using by viewing your source, php comments never make it to the viewer's browser.

    2 replies

    Jon Fritz
    Community Expert
    Community Expert
    December 11, 2017

    I typically use php comments if I'm hiding something from the browser...

    <?php /* your code here */ ?>

    On a .php page, the server will remove the entire comment from your code.

    Anyone looking at the page source sees only what the browser sees, no <!-- start header here --> or <!-- end footer --> mixed into your final html.

    JackAuthor
    Inspiring
    December 12, 2017

    Right, but please see my reply to Nancy. I wondered if there was a character-set that would allow the server to ignore just a portion of a line of html, as in, for example:

    The quick brown fox jumped <<under>>over the lazy dog’s back,

    where all content between << . . . >> would be ignored.

    Is there an ‘ignore' character set, that one can use ‘inline’, in place of ‘<<' . . . '>>’ above?

    Best,

    jwc

    BenPleysier
    Community Expert
    Community Expert
    December 12, 2017

    Please have a look at https://html.com/tags/comment-tag/

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Nancy OShea
    Community Expert
    Community Expert
    December 11, 2017

    When you say a partial line of HTML, make sure you're not creating code errors for yourself.

    <h4>Heading 4 </h4>

    <!--html commented out code goes inside here-->

    <p>This is a sentence in a paragraph</p>

    Nancy O'Shea— Product User & Community Expert
    JackAuthor
    Inspiring
    December 12, 2017

    I take this to mean that it is not possible to comment-out a part of a line(?).

    IOW, I thought that there were alternative start/stop symbols for commenting-out a part of a line of html.

    Best,

    jwc