Thanakron Tandavas
Thanakron Tandavas

Reputation: 5683

Why HTML comment indentation is displayed differently in browser?

I was trying to beautify my html so that whenever someone click view source on my page can see it. So, I decided to write my name as a comment on top of my html. However, what is shown on Google Chrome's view source was different from what I see in Notepad++. Like in the picture :

enter image description here

Why I didn't get what I typed in notepad++ ? Is it because Notepad++ use different font with Google Chrome ? If yes, what's the font used in Google Chrome ?

How can I get what I want to display nicely on Google Chrome's view source?

P.S. I haven't tried it with other browsers yet.

Upvotes: 0

Views: 174

Answers (2)

George Netu
George Netu

Reputation: 2832

It is very difficult (I would say impossible) to do this everywhere you want. I mean, the purpose of that visual appearance is to embellish your code on a platform; it differs from an editor to another whether character spacing, line wrapping or even word wrapping are used or not. Regards.

Upvotes: 0

Musa
Musa

Reputation: 97672

The problem I see there is word wrap. If your line of text is too long it will be wrapped to the next line. I doubt there is a solution for this except in making the message shorter and hoping the user window is wider than the message.

Upvotes: 2

Related Questions