ต่อไปนี้คือรหัสสำหรับสร้างแบบฟอร์มการสมัครโดยใช้ HTML และ CSS -
ตัวอย่าง
<!DOCTYPE html> <html> <head> <style> body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } * {box-sizing: border-box} input[type=text], input[type=password] { width: 100%; font-size: 28px; padding: 15px; margin: 5px 0 22px 0; display: inline-block; border: none; background: #f1f1f1; } label{ font-size: 15px; } input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none; } hr { border: 1px solid #f1f1f1; margin-bottom: 25px; } button { font-size: 18px; font-weight: bold; background-color: rgb(10, 119, 13); color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; } button:hover { opacity:1; } .cancel { padding: 14px 20px; background-color: #ff3d2f; } .formContainer { padding: 16px; } .formContainer p{ font-size: 28px; } </style> <body> <form> <div class="formContainer"> <h1>Sign Up Form</h1> <hr> <label for="email"><b>Email</b></label> <input type="text" placeholder="Enter Email" name="email" required> <label for="password"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="password" required> <label for="repeatPassword"><b>Repeat Password</b></label> <input type="password" placeholder="Repeat Password" name="repeatPassword" required> <label> <input type="checkbox" checked="checked" name="remember" style="marginbottom: 15px"> Remember me </label> <p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a><p> <div> <button type="button" class="cancel">Cancel</button> <button type="submit" class="signup">Sign Up</button> </div> </div> </form> </body> </html>
ผลลัพธ์
สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้ -