কিভাবে তৈরি করবেন: নিবন্ধন ফর্ম
CSS ব্যবহার করে রেসপন্সিভ নিবন্ধন ফর্ম কিভাবে তৈরি করবেন শিখুন。
নিবন্ধন ফর্মটি খুলতে বাটন ক্লিক করুন:
কিভাবে নিবন্ধন ফর্ম তৈরি করবেন
প্রথম পদক্ষেপ - এইচটিএমএল যোগ করুন:
ইনপুট প্রক্রিয়াকরণ করার জন্য <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>
দ্বিতীয় পদক্ষেপ - সিএসএস যোগ করুন:
* {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%; } }
কিভাবে মড্যাল নিবন্ধন ফর্ম তৈরি করবেন
প্রথম পদক্ষেপ - এইচটিএমএল যোগ করুন:
ইনপুট প্রক্রিয়াকরণ করার জন্য <form> ইলেমেন্ট ব্যবহার করুন। আপনি আমাদের PHP ট্যুটোরিয়ালে আরও বিস্তারিত তথ্য পাবেন।
প্রত্যেক ফিল্ডের জন্য ইনপুট কন্ট্রোল যোগ করুন (এবং ম্যাচিং ট্যাগ):
<!-- Button to open the modal --> <button onclick="document.getElementById('id01').style.display='block'">সাইন আপ</button> <!-- The Modal (contains the Sign Up form) --> <div id="id01" class="modal"> <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">টাইমস;</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>
দ্বিতীয় পদক্ষেপ - সিএসএস যোগ করুন:
* {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 { background-color: #fefefe; margin: 5% auto 15% auto; /* শীর্ষে 5%, নিচে 15%, এবং কেন্দ্রে */ border: 1px solid #888; width: 80%; /* সক্রিনের মাপ অনুযায়ী বেশি বা কম */ } /* হরিজনের শৈলী নির্ধারণ */ hr { border: 1px solid #f1f1f1; margin-bottom: 25px; } /* বন্ধ করা (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>
相关页面
教程:সিএসএস ফর্ম