HTML – Table Cell Tag Used Outside of a Table

Home Forums Bugs HTML – Table Cell Tag Used Outside of a Table

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1439
    Eugest Xhelollari
    Participant

    🔴 Error 3 — profile.php

    <td> tags used outside of a table
    ❌ Before (broken):

    <div>
    <td><?php echo $_SESSION[‘info’][‘username’]?></td>
    </div>
    <div>
    <td><?php echo $_SESSION[‘info’][’email’]?></td>
    </div>

    What’s wrong: <td> is a table cell tag and should only ever be used inside a <table>. Using it inside a <div> is invalid HTML — browsers will try to guess what you meant and may display it incorrectly or inconsistently.

    âś… After (fixed):

    <!– Use a plain <div> or <span> to display text outside of a table –>
    <div>
    <div><?php echo $_SESSION[‘info’][‘username’]?></div>
    </div>
    <div>
    <div><?php echo $_SESSION[‘info’][’email’]?></div>
    </div>

    Why it’s fixed: Replacing <td> with <div> makes the HTML valid and ensures the content displays correctly in all browsers.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.