How to Use Comment Tag for Div Class

Hi,

Please suggest how to use comment tag in div class.

Questions
1.Is the below mentioned comment tag the right form to use in div class? if not, please suggest.

<!--div class="image-left"> </div-->

2.The following code is right or wrong in my website code below:

<!--div class="image-left">

<figure><img src="http://localhost/scgs/wp-content/uploads/2015/11/hero2.jpg" alt="hero2" width="300" height="200"></figure>

<div>

<h2>High Class Training</h2>

Southern Cross Security is committed to the protection of our Clients and their assets. We deliver a reliable, results-driven security service that is underpinned by a superior customer service.

It is our mission to provide an integrated security service that is personalised to meet the unique requirements of our clients, whilst consistently demonstrating diligence, honesty, and integrity at the highest levels.

</div>
</div>

<div class="image-right">

<figure><img src="http://localhost/scgs/wp-content/uploads/2015/11/hero2.jpg" alt="hero2" width="300" height="200"></figure>

<div>

<h2>High Class Training</h2>

Southern Cross Security is committed to the protection of our Clients and their assets. We deliver a reliable, results-driven security service that is underpinned by a superior customer service.

It is our mission to provide an integrated security service that is personalised to meet the unique requirements of our clients, whilst consistently demonstrating diligence, honesty, and integrity at the highest levels.

</div>
</div>

<div class="success-story">
<div class="wrap">
<img src="http://localhost/scgs/wp-content/uploads/2015/11/arts-south-australia.jpg" alt="arts-south-australia" width="300" height="200">

<div>

<h2><small>Success Story</small> Arts South Australia</h2>

A brief about the project and offered services to this very client. Something like interesting about so new visitors can get some real ideas of SCGS services and professionalism. A brief about the project and offered services to this very client. Something like interesting about so new visitors can get some real ideas of SCGS services and professionalism.
</div></div>
</div-->

What exactly are you trying to do?

<!--div class="image-left"> </div-->

is going to comment out the div tag, although it’s an odd way to do it. I would be more inclined to have

<!-- comment out div tag
<div class"woteva">
 ...
</div>
-->

Thanks for the reply. I am trying to use comment tag for div class instead of remove the lines.

I’m afraid this sentence doesn’t make any sense. For one thing div is a tag not a class. A comment is a comment. You can add it (virtually) anywhere in your HTML. It doesn’t interact with other tags.

Perhaps what you’re trying for is

<div class="woteva">
  <!-- Hello, I'm a comment -->
</div>

I am not clearly explained you. I used comment tag but it’s not working.

There is NO such thing as a comment tag.

There ARE comment marks.

HTML comment marks look like this
<!-- opens the comment
--> closes the comment.

Your code is correct, but as @Gandalf said, it is an unusual way to apply comment marks. As long as you recognize what you are doing, then it’s OK.

Your explanation of how you think you are using your comment marks sounds like you are confused about how comment marks work.

You are doing here .

<!--div class="image-left">

It shoud be


<!--<div class="image-left">

same when closing.

</div>--> Not </div--->

Both examples accomplish the same thing.

The opening comment mark <!-- hides subsequent HTML until it finds a closing comment mark -->. Placing the comment marks before and after the element(s) as you show them, rather than within the opening and closing tags, is more readable and less likely to be overlooked, but both accomplish the same thing.

Personally, I usually put the opening and closing comment marks on a line above the opening and a line below the closing element tags, like this:

<!--
    <figure class="className">
        <img src="photo-fred.jpg"...>
        <figcaption>Fred Who (sliding into first)</figcaption>
    </figure>
-->

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.