Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS में टेबल लेआउट को नियंत्रित करना

CSS table-layout प्रॉपर्टी ब्राउज़र द्वारा टेबल की पंक्तियों, कॉलम्स और सेल्स को लेआउट करने के लिए उपयोग किए जाने वाले एल्गोरिदम को परिभाषित करने के लिए है। इसके माध्यम से, आप टेबल लेआउट को नियंत्रित कर सकते हैं।

सिंटैक्स

CSS table-layout प्रॉपर्टी का सिंटैक्स निम्नानुसार है:

Selector {    table-layout: /*value*/ }

निम्नलिखित उदाहरण CSS table-layout प्रॉपर्टी को दर्शाते हैं:

उदाहरण

<!DOCTYPE html> <html> <head> <style> table {    margin: 2em;    display: inline-block;    border: 1px solid black; } td {    border: 1px solid black; } #one {    table-layout: auto;    width: auto; } #one + table {    table-layout: fixed;    width: 100px; } </style> </head> <body> <h2>Table Layouts and its working in CSS</h2> <table id="one"> <caption>Cricketers</caption> <tr> <td>ShaneWarne</td> </tr> <tr> <td></td> <td>Adam</td> </tr> <tr> <td></td> <td>Shimron Hetmyer</td> <td></td> </tr> </table> <table> <caption>Cricketers</caption> <tr> <td>ShaneWarne</td> </tr> <tr> <td></td> <td>Adam</td> </tr> <tr> <td></td> <td>Shimron Hetmyer</td> <td></td> </tr> </table> </body> </html>

आउटपुट

यह निम्नलिखित आउटपुट देता है:

CSS में टेबल लेआउट को नियंत्रित करना

दूसरा उदाहरण

<!DOCTYPE html> <html> <head> <style> div {    margin: auto;    width: 50%;    box-shadow: inset 0 0 14px orange; } td {    box-shadow: inset 0 0 5px lime;    white-space: nowrap;    outline: thin dotted; } table {    border: 3px solid black;    table-layout: fixed;    width: 100%; } </style> </head> <body> <div> <table> <caption>Demo Caption</caption> <tr> <td>ABCD</td> </tr> <tr> <td></td> <td>EFGH</td> </tr> <tr> <td></td> <td>IJKLM NOPQRST</td> <td></td> </tr> </table> </div> </body> </html>

आउटपुट

यह निम्नलिखित आउटपुट देता है:

CSS में टेबल लेआउट को नियंत्रित करना

  1. CSS से तुलना टेबल (कॉम्पेरिजन टेबल) कैसे बनाएं? CSS से तुलना टेबल (कॉम्पेरिजन टेबल) कैसे बनाएं?

    कॉम्पेरिजन टेबल में फीचर कॉलम बाएं, प्लान कॉलम दाएं होते हैं। nth-child(even) से वैकल्पिक पंक्ति रंग, पहले कॉलम लेफ्ट-अलाइन, बाकी सेंटर। रिस्पॉन्सिव नहीं है लेकिन साफ डिज़ाइन। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=

  1. CSS से रिस्पॉन्सिव टेबल कैसे बनाएं? CSS से रिस्पॉन्सिव टेबल कैसे बनाएं?

    रिस्पॉन्सिव टेबल के लिए टेबल को overflow-x: auto वाले डिव में लपेटें। छोटे स्क्रीन पर क्षैतिज स्क्रॉलबार दिखाई देगा, टेबल संरचना बनी रहती है। ज़ेबरा स्ट्रिपिंग शामिल है। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1>

  1. एडवांस CSS लेआउट फ्लेक्सबॉक्स के साथ एडवांस CSS लेआउट फ्लेक्सबॉक्स के साथ

    CSS3 फ्लेक्सबॉक्स (Flexible Box) जटिल लेआउट के लिए शक्तिशाली मोड है। कंटेनर प्रॉपर्टी: flex-direction, flex-wrap, flex-flow, justify-content, align-items, align-content। आइटम प्रॉपर्टी: flex-grow, flex-shrink, flex-basis, align-self, order। उदाहरण div { background-color: #f1f1f1; margin: 10