<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta…
- Usercode
<div class="wrapper"> <form action=""> <h1>Login</h1> <div class="input-box"> <input type="text" placeholder="Username" required> <i class='bx bxs-user'></i> </div> <div class="input-box"> <input type="password" placeholder="Password" required> <i class='bx bxs-lock-alt'></i> </div> <div class="remember-forgot"> <label><input type="checkbox"> Remember me</label> <a href="#">Forgot password?</a> </div> <button type="submit" class="btn">Login</button> <div class="register-link"> <p>Don't have an account? <a href="#">Register</a></p> </div> </form> </div> - Assistant
Yes, you can make the login button redirect to a new page by setting the action attribute of the form to the URL of the page you want to redirect to upon form submission. Here's how you can modify your form tag to achieve this. Suppose you want to redirect the user to a page named "dashboard.html" after they click the login button and submit the form:
html - Usercode
<div class="wrapper"> <form action="main.html"> <h1>Login</h1> <div class="input-box"> <input type="text" placeholder="Username" required> <i class='bx bxs-user'></i> </div> <div class="input-box"> <input type="password" placeholder="Password" required> <i class='bx bxs-lock-alt'></i> </div> <div class="remember-forgot"> <label><input type="checkbox"> Remember me</label> <a href="#">Forgot password?</a> </div> <button type="submit" class="btn">Login</button> <div class="register-link"> <p>Don't have an account? <a href="#">Register</a></p> </div> </form> </div> - Assistant
The HTML code you've shared creates a simple login form styled with external CSS and Boxicons for visual elements like user icons and lock icons. The form is configured to submit to "main.html" upon successful submission, which is achieved by setting the
actionattribute of theformtag to "main.html". This means when the user fills in their username and password and clicks the "Login" button, they will be redirected to the "main.html" page.If you need to make any modifications or have specific requirements beyond this redirection, such as validation, error handling, or integrating with a backend service for authentication, those aspects would need to be addressed with additional code, potentially including JavaScript for frontend validation or server-side code for actual authentication against a user database.
For a basic implementation to enhance this form, you might consider adding front-end validation with JavaScript or ensuring the form handles input securely. Remember that real authentication would require a backend system to securely process and validate user credentials against stored data.
If you have any more questions or need further customization, feel free to ask!