Site logo

Archived topic

HTML comment in GeneratePress?

3 replies · Started by Artem on December 4, 2019

Viewing posts 1–4 of 4

Hi. When I code in the content area and use HTML comment like this <!-- comment --> my child div is moved down as if there is a text line before the child div:

<div>   
                           <!-- This is a comment -->
                           <div></div>
</div>

Text "This is a comment" is not visible, but it occupies the space.
Margin: 0; padding: 0; don't help. Only removing this comment removes an empty space.
When I test the code in CODEPEN everything is OK.
How can I comment on my code in GeneratePress?
Thanks.

Hi there,

I'm not quite sure if I understand but GP doesn't do anything special for HTML comment.

The content between <!-- and --> would be marked as a comment.

I'm not sure what all the <div>s are for?

Hi Leo,
<div>s are for page layout. I'm coding my homepage in HTML. So, the problem appears when you switch between HTML editor and Visual editor. Apparently, the visual editor changes your HTML a little bit.
I started from scratch with a new page and the problem has gone.
Thank you.

No problem :)

This archived topic is closed to new replies.