htmlvisual-studio-codenpm-live-server

Why is Live Server only loading half my HTML code?


I have searched the internet for hours trying to find someone else who shared my issue, but it seems to be entirely unique to me.

So basically, I launch my very small HTML file with live server, but only 2 divs are loaded on the webpage, and I have no idea why. I have tested it and narrowed it down to purely being an issue caused by live server, as my html file loads completely fine when the file itself is double-clicked on from file explorer, and I still have the issue when i remove my links to my css and js files from the hmtl file.

this happens on the simplest of code, and its so annoying.

here is some simple code:

enter image description here

and here is the screenshot of the elements not loading:

enter image description here

and i also show the "code injected by live server" bit, cause i think that might be the issue?

please help, this is driving me crazy. ps. i am a newbie to live server and website making.


Solution

  • There can only be one body tag in whole HTML file. You can try this instead :

    <html>
      <head>
        <title>HTML page</title>
      </head>
      <body>
        <div>
          <p>text</p>
        </div>
        <div>
          <p>text</p>
        </div>
        <div>
          <p>text</p>
        </div>
        <div>
          <p>text</p>
        </div>
      </body>
    </html>