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

CSS से रिस्पॉन्सिव पोर्टफोलियो गैलरी ग्रिड कैसे बनाएं?


CSS से रिस्पॉन्सिव पोर्टफोलियो गैलरी ग्रिड बनाने का कोड निम्नलिखित है:

उदाहरण

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style> * {    box-sizing: border-box; } h1 {    font-size: 50px;    text-align: center;    font-family: monospace, serif, sans-serif; } body {    background-color: #f1f1f1;    padding: 20px;    font-family: Arial; } main {    max-width: 1000px;    margin: auto; } img {    width: 100%; } .portfolioContainer {    margin: 8px -16px; } .portfolioContainer, .portfolioContainer > .ImageCol {    padding: 8px; } .ImageCol {    float: left;    width: 25%; } .portfolioContainer:after {    content: "";    display: table;    clear: both; } .portfolioContent {    background-color: white;    padding: 10px; } @media screen and (max-width: 900px) { .ImageCol {    width: 50%; } } @media screen and (max-width: 600px) { .ImageCol {    width: 100%; } } </style> </head> <body> <main> <h1>Photography</h1> <hr /> <div class="portfolioContainer"> <div class="ImageCol"> <div class="portfolioContent"> <img src="https://i.picsum.photos/id/531/400/400.jpg" /> <h3>Picture 1</h3> <p>Clicked at my house</p> </div> </div> <div class="ImageCol"> <div class="portfolioContent"> <img src="https://i.picsum.photos/id/511/400/400.jpg" /> <h3>Picture 2</h3> <p>Clicked at Tenesse</p> </div> </div> <div class="ImageCol"> <div class="portfolioContent"> <img src="https://i.picsum.photos/id/521/400/400.jpg" /> <h3>Picture 3</h3> <p>Clicked on a bridge while travelling</p> </div> </div> <div class="ImageCol"> <div class="portfolioContent"> <img src="https://i.picsum.photos/id/551/400/400.jpg" /> <h3>Picture 4</h3> <p>Riding my safari jeep in sahara</p> </div> </div> </div> </main> </body> </html>

आउटपुट

उपरोक्त कोड निम्नलिखित आउटपुट उत्पन्न करेगा:

CSS से रिस्पॉन्सिव पोर्टफोलियो गैलरी ग्रिड कैसे बनाएं?


  1. CSS से 3-कॉलम लेआउट ग्रिड बनाना CSS से 3-कॉलम लेआउट ग्रिड बनाना

    3-कॉलम ग्रिड लेआउट CSS से 3-कॉलम लेआउट ग्रिड बनाने के लिए निम्न कोड उपयोग करें: उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1 /> <style> body { padding: 1%; font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-seri

  1. CSS से 2-कॉलम लेआउट ग्रिड बनाना CSS से 2-कॉलम लेआउट ग्रिड बनाना

    2-कॉलम ग्रिड लेआउट CSS से 2-कॉलम लेआउट ग्रिड बनाने के लिए निम्न कोड उपयोग करें: उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1 /> <style> body { font-family: Arial; color: white; } .left, .right { height: 50%; width

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

    उदाहरण CSS से रिस्पॉन्सिव ब्लॉग लेआउट बनाने के लिए, निम्न कोड का उपयोग करें: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    * {       box-sizing: border-box; &n