0

I would like to look at the html code of the CNN website (specific this website) and even copy and paste it in Sublime. But this is the only site if I press Ctrl+U that just gives me one long line of code that is about 10 pages long.

If I paste this code in sublime or any other editor it also acts just like one long line, and gives you a big block of code. But when I right click on the site and go to "Inspect Element" in Firefox, it gives me the code as one would expect it.

These look like two completely different sets of code, and I am wondering why this is.

Alfa Bravo
  • 1,961
  • 2
  • 25
  • 45

1 Answers1

2

"Inspect elements" shows a textual reconstruction of the DOM. Since this is a reconstructed interactive view it will appear valid (eg. closing tags are added as required) and be displayed in a prettily indented manner.

Use "View page source" to see the actual original HTML markup text.

In this case the actual HTML is one line - and there is nothing technically wrong with that.


You may be interested in using Sublime (or another tool) to prettify/reformat the HTML:

Community
  • 1
  • 1
user2864740
  • 60,010
  • 15
  • 145
  • 220
  • Thank you user, after following all the link and opening up 20 tabs full of info I got it organized with Prettify. Prettify worked really well for me. Regards – Alfa Bravo Nov 24 '16 at 11:43