Invalid HTML causing odd effects

  • Bug
  • Thread starter Jonathan Scott
  • Start date
In summary, the conversation discusses an issue with an invalid HTML comment appearing on the screen in Google Chrome. The commenter notes that the dashes in the comment should be double, but they are not. They also mention that as a contributor, they do not expect to see any ads. The issue is further explained, with a similar invalid comment being mentioned and an explanation of the cause - an en-dash being used instead of a double dash, possibly due to a "intelligent" word-processing editor.
  • #1
Jonathan Scott
Gold Member
2,340
1,149
I'm getting bits of an invalid HTML comment appearing on the screen at times in Google Chrome. From "View Source" I see that the whole string is as follows:

<!– google_ad_section_start(weight=ignore) –>

This is an invalid comment because the dashes should be double. As I'm a contributor I'm not expecting to see any ads anyway. I don't know why Chrome (dev build) is letting bits of it leak into the displayed document, and that might be a bug, but it shouldn't be there anyway.
 
Physics news on Phys.org
  • #2
I'm also getting similar bits showing from another invalid comment as follows, matching the earlier one:

<!– google_ad_section_end –>

I've now worked out what is going on, in that a browser search on "end ->" did not find the above, and by cutting and pasting it and using debug to look at it in hex I found that what appears at first glance in my Windows browser to be a normal dash is actually an extended ASCII code 150, which is an en-dash in the usual Windows code. I guess someone entered this using a "intelligent" word-processing editor which changes double dash to the Windows en-dash, so it doesn't work as a comment.
 

1. What is invalid HTML?

Invalid HTML refers to HTML code that does not follow the correct syntax and structure set by the HTML standards. This can result in unexpected or incorrect display of the webpage.

2. How can invalid HTML cause odd effects?

Invalid HTML can cause odd effects because web browsers use HTML to interpret and display webpages. If the HTML code is not valid, the browser may not be able to properly render the webpage, resulting in odd or unexpected behavior.

3. What are some common causes of invalid HTML?

Some common causes of invalid HTML include missing closing tags, using outdated or deprecated HTML elements, and incorrect nesting of HTML elements. Typos and mistakes in the code can also result in invalid HTML.

4. How can I check if my HTML code is valid?

You can use an online HTML validator, such as the W3C Markup Validation Service, to check your HTML code for validity. These tools will identify any errors in your code and provide suggestions for fixing them.

5. Why is it important to use valid HTML?

Using valid HTML is important because it ensures that your webpage will be displayed correctly across different browsers and devices. It also helps with search engine optimization and improves accessibility for users with disabilities.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
Replies
5
Views
2K
  • Computing and Technology
Replies
19
Views
13K
  • Programming and Computer Science
Replies
2
Views
3K
  • STEM Academic Advising
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
274
  • Sci-Fi Writing and World Building
Replies
3
Views
2K
Replies
13
Views
6K
  • Introductory Physics Homework Help
Replies
2
Views
2K
Back
Top