कैसे बनाएं: छवि पर फॉर्म
CSS के द्वारा पूर्ण चौड़ाई वाली छवि पर फॉर्म कैसे जोड़ें सीखें。
छवि पर फॉर्म
कैसे छवि में फॉर्म जोड़ें
पहला कदम - HTML जोड़ें:
<div class="bg-img"> <form action="/action_page.php" class="container"> <h1>Login</h1> <label for="email"><b>Email</b></label> <input type="text" placeholder="Enter Email" name="email" required> <label for="psw"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="psw" required> <button type="submit" class="btn">Login</button> </form> </div>
दूसरा कदम - CSS जोड़ें:
body, html { height: 100%; } * { box-sizing: border-box; } .bg-img { /* इस्तेमाल किए जाने वाले चित्र */ background-image: url("img_nature.jpg"); /* चित्र की ऊंचाई को नियंत्रित करने */ min-height: 380px; /* चित्र को केंद्र में रखे और उचित रूप से स्केल करने */ background-position: center; background-repeat: no-repeat; background-size: cover; position: relative; } /* फॉर्म कंटेनर को स्टाइल जोड़ें */ .container { position: absolute; right: 0; margin: 20px; max-width: 300px; padding: 16px; background-color: white; } /* पूरे चौड़े इनपुट फील्ड */ input[type=text], input[type=password] { width: 100%; padding: 15px; margin: 5px 0 22px 0; border: none; background: #f1f1f1; } input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none; } /* फॉर्म सबमिट बटन के लिए स्टाइल सेट करने के लिए */ .btn { background-color: #04AA6D; color: white; padding: 16px 20px; border: none; cursor: pointer; width: 100%; opacity: 0.9; } .btn:hover { opacity: 1; }