Online Computer Courses Classes and Training Program

HTML में Table बनाने का आसान Tutorial - Class 7 के लिए


HTML में Table (टेबल) का उपयोग डेटा को रोows और कॉलम में व्यवस्थित तरीके से प्रदर्शित करने के लिए किया जाता है। इसे समझने और बनाने के लिए नीचे आसान स्टेप्स दिए गए हैं।


HTML Table के Basic Tags

  1. <table>: टेबल शुरू करने के लिए।
  2. <tr>: टेबल की एक रो (row) बनाने के लिए।
  3. <td>: टेबल की एक सेल (data cell) बनाने के लिए।
  4. <th>: हेडिंग सेल बनाने के लिए (Bold Text)।
  5. border (attribute): टेबल की सीमा (border) सेट करने के लिए।

HTML Table का Example Code

<!DOCTYPE html>
<html>
<head>
    <title>HTML Table Example</title>
</head>
<body>
    <h1>My First HTML Table</h1>
    <table border="1">
        <tr>
            <th>Roll No</th>
            <th>Name</th>
            <th>Class</th>
        </tr>
        <tr>
            <td>1</td>
            <td>Rahul</td>
            <td>7</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Anjali</td>
            <td>7</td>
        </tr>
        <tr>
            <td>3</td>
            <td>Aman</td>
            <td>7</td>
        </tr>
    </table>
</body>
</html>

कोड को समझें

  1. <table border="1">: टेबल को बॉर्डर देता है। बॉर्डर का "1" मतलब एक पतली लाइन।
  2. <th>: हेडिंग सेल के लिए। उदाहरण: Roll No, Name, Class
  3. <tr>: हर रो की शुरुआत और अंत को दर्शाता है।
  4. <td>: सेल के अंदर का डेटा।

Output (आउटपुट)

जब आप इस कोड को ब्राउज़र में रन करेंगे, तो आपको नीचे जैसा टेबल दिखाई देगा:

Roll No Name Class
1 Rahul 7
2 Anjali 7
3 Aman 7

Practice Task for Class 7

आप नीचे दिए गए प्रश्नों के लिए एक टेबल बनाएं:

  1. अपने पांच दोस्तों के नाम, उम्र और पसंदीदा खेल लिखें।
  2. अपना स्कूल टाइम-टेबल (Class Schedule) बनाएं।

Tip: HTML टेबल को कस्टमाइज़ करने के लिए style (जैसे - रंग, पृष्ठभूमि) जोड़ सकते हैं।


Bonus: आप HTML को नोटपैड में लिखकर .html एक्सटेंशन के साथ सेव करें और इसे ब्राउज़र में ओपन करें।


HTML Table Related Questions

1. Multiple Choice Questions (MCQ)

  1. Which tag is used to create a table in HTML?
    a) <table>
    b) <div>
    c) <row>
    d) <cell>
    Answer: a) <table>

  2. Which tag is used to create a row in a table?
    a) <td>
    b) <th>
    c) <tr>
    d) <br>
    Answer: c) <tr>

  3. Which attribute is used to set the border of a table?
    a) width
    b) border
    c) style
    d) align
    Answer: b) border

  4. Which tag is used to add headings to a table?
    a) <th>
    b) <td>
    c) <head>
    d) <title>
    Answer: a) <th>

  5. What is the default alignment of content in a <td> tag?
    a) Center
    b) Right
    c) Left
    d) Justify
    Answer: c) Left


2. Fill in the Blanks

  1. The <______> tag is used to define a table in HTML.
    Answer: table

  2. A table row is created using the <______> tag.
    Answer: tr

  3. Table headings are written using the <______> tag.
    Answer: th

  4. The <______> tag is used to define the data inside a table cell.
    Answer: td

  5. To add a border to a table, the ______ attribute is used.
    Answer: border


3. True or False

  1. The <td> tag is used to create table headings.
    Answer: False

  2. The <tr> tag is used to create rows in a table.
    Answer: True

  3. The border attribute is mandatory to create a table.
    Answer: False

  4. Content inside a <th> tag is bold and centered by default.
    Answer: True

  5. You can create a table without using the <table> tag.
    Answer: False


4. Short Answer Questions

  1. What is the purpose of the <table> tag in HTML?
    Answer: The <table> tag is used to create a table to organize data in rows and columns.

  2. What is the difference between <th> and <td> tags?
    Answer: The <th> tag is used for table headings and makes the content bold and centered by default, while the <td> tag is used for normal table cells.

  3. Which attribute is used to set a border for the table, and how is it used?
    Answer: The border attribute is used to set the table's border. Example: <table border="1">.

  4. Write the basic structure of an HTML table.
    Answer:

    <table>
        <tr>
            <th>Heading 1</th>
            <th>Heading 2</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
    </table>
    
  5. What happens if you don’t use the border attribute in a table?
    Answer: If the border attribute is not used, the table will appear without borders, making it look invisible.


Post a Comment

0 Comments