๐ฐ Introduction
Agar aap HTML Table banana seekh rahe hain, to sirf theory padhna kaafi nahi hai. Real coding examples ki practice karna bhi bahut zaroori hai. Is example me hum ek simple Product-Price Table banana seekhenge jisme products aur unki prices ko rows aur columns ki help se display kiya gaya hai. Isse aap <table>, <tr> aur <td> tags ka practical use aasani se samajh paenge.
๐ Description
Is example me humne ek simple HTML Table banayi hai jisme do products Laptop aur Mobile ke naam aur unki prices dikhai gayi hain. Browser me output ek clean aur well-organized Product-Price Table ke roop me dikhai dega, jisse information ko padhna aur compare karna bahut aasaan ho jata hai. Yeh example beginners ke liye HTML Table ka basic structure aur data ko rows aur columns me display karna sikhne ka ek behtareen practice example hai.
Agar aapne HTML Table ka theory article padh liya hai, to ab time hai ise practically samajhne ka ๐ช Practice ke bina coding complete nahi hoti.
๐ Is tutorial me hum basic se lekar advanced tak HTML table banana step-by-step seekhenge ๐
๐ฐ Step 1: Basic Table Banana
Sabse pehle ek simple table banana seekhte hain.
<table border="1">
<tr>
<td>Hello World</td>
</tr>
</table>
| Hello World |
Ek simple table dikhega jisme ek box hoga aur usme "Hello World" likha hoga.
๐ Step 2: Rows aur Columns Add Karna
Ab hum multiple rows aur columns add karenge.
<table border="1">
<tr>
<td>HTML</td>
<td>CSS</td>
</tr>
<tr>
<td>JavaScript</td>
<td>React</td>
</tr>
</table>
| HTML | CSS |
| JavaScript | React |
Table me 2 rows aur 2 columns honge jisme technologies ke naam dikhenge.
๐งฉ Step 3: Heading Add Karna (<th>)
Table me heading add karne ke liye <th> tag use hota hai.
<table border="1">
<tr>
<th>Name</th>
<th>Course</th>
<th>Marks</th>
</tr>
<tr>
<td>Sanjay</td>
<td>HTML</td>
<td>95</td>
</tr>
</table>
| Name | Course | Marks |
|---|---|---|
| Sanjay | HTML | 95 |
Table ke top me bold headings dikhenge aur neeche student ka data show hoga.
๐จ Step 4: Table Styling (CSS)
Ab table ko thoda professional look dete hain.
<table style="border-collapse:collapse; width:100%;" border="1">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Mobile</td>
<td>10000</td>
</tr>
</table>
| Product | Price |
|---|---|
| Mobile | 10000 |
Table full width me dikhega aur borders clean aur joined honge.
๐งฑ Step 5: Border Control Karna
Border ko CSS se bhi control kiya ja sakta hai.
<style>
table, th, td {
border: 1px solid red;
}
</style>
<table>
<tr>
<td>Data</td>
</tr>
</table>
| Data |
Table aur cells ke around red border dikhega.
๐ Step 6: Colspan Use Karna
Column merge karne ke liye colspan use hota hai.
<table border="1">
<tr>
<th colspan="2">Student Info</th>
</tr>
<tr>
<td>Name</td>
<td>Sanjay</td>
</tr>
</table>
| Student Info | |
|---|---|
| Name | Sanjay |
Heading 2 columns ke barabar width me dikhegi.
๐ Step 7: Rowspan Use Karna
Row merge karne ke liye rowspan use hota hai.
<table border="1">
<tr>
<td rowspan="2">Sanjay</td>
<td>HTML</td>
</tr>
<tr>
<td>CSS</td>
</tr>
</table>
| Sanjay | HTML |
| CSS |
Ek cell vertically 2 rows tak stretch karega.
๐ง๐ป Step 8: Real Table Project
Ab ek real-life example dekhte hain (price table).
<table border="1">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Laptop</td>
<td>50000</td>
</tr>
<tr>
<td>Mobile</td>
<td>15000</td>
</tr>
</table>
| Product | Price |
|---|---|
| Laptop | 50000 |
| Mobile | 15000 |
Ek clean product-price table dikhega jisme products aur unki price list hogi.
๐ Helpful Links
- HTML List Tutorial Full deep Guide Step by step
- HTML Text Formatting Tags Tutorial step by step
- HTML Paragraph Tags Tutorial step by step Guide
- Heading Tag Tutorial Step by Step Guide
๐ฏ Conclusion
๐ Ab aapne HTML table ko practically seekh liya hai ๐ช ๐ Ab next step hai: Practice Exercises solve karo aur MCQ quiz do ๐
๐ Regular practice se hi aap expert banoge ๐ฅ