कैसे बनाएं: पंजीकरण फॉर्म
- शिक्षा: पिछला पृष्ठ
- लॉगिन फॉर्म अगला पृष्ठ
CSS के द्वारा प्रतिसादी पंजीकरण फॉर्म कैसे बनाएं सीखें。
बटन पर क्लिक करके पंजीकरण फॉर्म खोलें:
कैसे पंजीकरण फॉर्म बनाएं
पहला कदम - HTML जोड़ें:
इनपुट एलीमेंट को प्रबंधित करने के लिए <form> एलीमेंट का उपयोग करें। आपको हमारे PHP शिक्षण में बारीकियाँ जानने के लिए अधिक जानकारी मिल सकती है。
प्रत्येक फील्ड के लिए इनपुट कंट्रोल जोड़ें (और समान लेबल):
<form action="action_page.php" style="border:1px solid #ccc"> <div class="container"> <h1>साइन अप</h1> <p>एक खाता बनाने के लिए इस फॉर्म को भरें。</p> <hr> <label for="email"><b>ईमेल</b></label> <input type="text" placeholder="ईमेल भरें" name="email" required> <label for="psw"><b>पासवर्ड</b></label> <input type="password" placeholder="पासवर्ड भरें" name="psw" required> <label for="psw-repeat"><b>पासवर्ड दोहराएं</b></label> <input type="password" placeholder="पासवर्ड दोहराएं" name="psw-repeat" required> <label> <input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px">मुझे याद रखें </label> <p>एक खाता बनाने से आप हमारे <a href="#" style="color:dodgerblue">शर्तें और गोपनीयता</a> के साथ सहमत होते हैं.</p> <div class="clearfix"> <button type="button" class="cancelbtn">रद्द करें</button> <button type="submit" class="signupbtn">पंजीकरण करें</button> </div> </div> </form>
दूसरा - चरण - CSS जोड़ें:
* {box-sizing: border-box} /* पूर्ण चौड़ाई इनपुट फील्ड */ input[type=text], input[type=password] { width: 100%; padding: 15px; margin: 5px 0 22px 0; display: inline-block; border: none; background: #f1f1f1; } input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none; } hr { border: 1px solid #f1f1f1; margin-bottom: 25px; } /* सभी बटन के लिए शैली सेट करें */ button { background-color: #04AA6D; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; } button:hover { opacity:1; } /* रद्द बटन के अतिरिक्त शैली सेट करें */ .cancelbtn { padding: 14px 20px; background-color: #f44336; } /* रद्द और पंजीकरण बटन को फ्लॉटिंग करें और समान चौड़ाई जोड़ें */ .cancelbtn, .signupbtn { float: left; width: 50%; } /* कंटेनर एलीमेंट में आंतरिक बॉर्डर जोड़ें */ .container { padding: 16px; } /* फ्लॉटिंग बार निकालें */ .clearfix::after { content: ""; clear: both; display: table; } /* अति-सूक्ष्म स्क्रीन पर रद्द बटन और रजिस्ट्रेशन बटन के शैली को परिवर्तित करें */ @media screen and (max-width: 300px) { .cancelbtn, .signupbtn { width: 100%; } }
कैसे मोडल पंजीकरण फॉर्म बनाएं
पहला कदम - HTML जोड़ें:
इनपुट एलीमेंट को प्रबंधित करने के लिए <form> एलीमेंट का उपयोग करें। आपको हमारे PHP शिक्षण में बारीकियाँ जानने के लिए अधिक जानकारी मिल सकती है。
प्रत्येक फील्ड के लिए इनपुट कंट्रोल जोड़ें (और समान लेबल):
<!-- मोडल खोलने के लिए बटन --> <button onclick="document.getElementById('id01').style.display='block'">पंजीकरण करें</button> <!-- आधारित मोडल (दर्शक पंजीकरण फॉर्म यहाँ है) --> <div id="id01" class="modal"> <span onclick="document.getElementById('id01').style.display='none'" class="close" title="बंद करें">times;</span> <form class="modal-content" action="/action_page.php"> <div class="container"> <h1>साइन अप</h1> <p>एक खाता बनाने के लिए इस फॉर्म को भरें。</p> <hr> <label for="email"><b>ईमेल</b></label> <input type="text" placeholder="ईमेल भरें" name="email" required> <label for="psw"><b>पासवर्ड</b></label> <input type="password" placeholder="पासवर्ड भरें" name="psw" required> <label for="psw-repeat"><b>पासवर्ड दोहराएं</b></label> <input type="password" placeholder="पासवर्ड दोहराएं" name="psw-repeat" required> <label> <input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> मुझे याद रखें </label> <p>एक खाता बनाने से आप हमारे <a href="#" style="color:dodgerblue">शर्तें और गोपनीयता</a> के साथ सहमत होते हैं.</p> <div class="clearfix"> <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">रद्द करें</button> <button type="submit" class="signup">Sign Up</button> </div> </div> </form> </div>
दूसरा - चरण - CSS जोड़ें:
* {box-sizing: border-box} /* पूर्ण चौड़ाई इनपुट फील्ड */ input[type=text], input[type=password] { width: 100%; padding: 15px; margin: 5px 0 22px 0; display: inline-block; border: none; background: #f1f1f1; } /* जब इनपुट बॉक्स पर फोकस होता है तो पृष्ठभूमि रंग जोड़ें */ input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none; } /* सभी बटन के लिए शैली सेट करें */ button { background-color: #04AA6D; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; } button:hover { opacity:1; } /* रद्द बटन के अतिरिक्त शैली सेट करें */ .cancelbtn { padding: 14px 20px; background-color: #f44336; } /* रद्द और पंजीकरण बटन फ्लोटिंग करें और बराबर की चौड़ाई निर्धारित करें */ .cancelbtn, .signupbtn { float: left; width: 50%; } /* कंटेनर तत्व को आंतरिक छेद जोड़ें */ .container { padding: 16px; } /* मॉडल (पृष्ठभूमि) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: #474e5d; padding-top: 50px; } /* Modal content/box */ .modal-content { background-color: #fefefe; margin: 5% auto 15% auto; /* 5% from top, 15% from bottom, and centered */ border: 1px solid #888; width: 80%; /* May be more or less, depending on screen size */ } /* Set horizontal line style */ hr { border: 1px solid #f1f1f1; margin-bottom: 25px; } /* Close button (x) */ .close { position: absolute; right: 35px; top: 15px; font-size: 40px; font-weight: bold; color: #f1f1f1; } .close:hover, .close:focus { color: #f44336; cursor: pointer; } /* Clear floats */ .clearfix::after { content: ""; clear: both; display: table; } /* अति-सूक्ष्म स्क्रीन पर रद्द बटन और रजिस्ट्रेशन बटन के शैली को परिवर्तित करें */ @media screen and (max-width: 300px) { .cancelbtn, .signupbtn { width: 100%; } }
सूचना:आप निम्नलिखित JavaScript को भी इस्तेमाल कर सकते हैं, जो मॉडल फ़ेटर के बाहर के किसी क्षेत्र पर क्लिक करके मॉडल को बंद करता है (केवल "×" या "cancel" बटन के द्वारा बंद करने के बजाय):
<script> // मॉडल प्राप्त करना var modal = document.getElementById('id01'); // जब उपयोगकर्ता मॉडल के बाहर के किसी स्थान पर क्लिक करता है तो इसे बंद करें window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } </script>
स्वयं को प्रयोग करें
संबंधित पृष्ठHTML फॉर्म
संबंधित पृष्ठCSS फॉर्म
- शिक्षा: पिछला पृष्ठ
- लॉगिन फॉर्म अगला पृष्ठ