Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    </>HTML

    Document foundations

    • What is HTML?
    • Metadata and language
    • Attributes and character references
    • Headings, paragraphs and formatting

    Content and media

    • Links
    • Images
    • Lists
    • Tables
    • Responsive images and media

    Forms

    • Forms and inputs
    • Grouping form controls
    • Form validation and submission

    Structure and accessibility

    • Semantic HTML
    • Keyboard and screen-reader access
    • Disclosure with details
    • Project: your profile page
    HTML

    Content and media · Lesson 8 of 16

    Tables

    Rows and columns with table, tr and td.

    7 minutes2 games

    A table is <table>, each row a <tr>, each normal cell a <td> and each header cell a <th>. Rows go top to bottom; cells go start to end.

    HTML
    <style>th, td { border: 1px solid; padding: 8px; } table { border-collapse: collapse; }</style>
    <table>
      <tr>
        <th>Language</th>
        <th>Year</th>
      </tr>
      <tr>
        <td>Python</td>
        <td>1991</td>
      </tr>
      <tr>
        <td>JavaScript</td>
        <td>1995</td>
      </tr>
    </table>

    Important

    caption names the table; scope="col" or "row" associates headers with cells. Use CSS instead of obsolete border and cellpadding presentation attributes.

    Interview question

    Why not use tables for page layout?

    Tables are for data only (schedules, prices…). Don't use them for page layout; that's CSS's job.

    Complete the code

    Complete a row with two cells.

    <>
      <td>Cairo</td>
      <>Egypt</td>
    </tr>

    Exercise

    Make a table with a header row (th) and 2 data rows.

    HTML
    <table>
    
    </table>
    

    Learn more from

    • MDN: HTML referencedeveloper.mozilla.org
    • web.dev: tablesweb.dev

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    PreviousListsNextResponsive images and media
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.