MÓDULO_TEÓRICO
Pro Forms: Login and Registration

Capturing User Identity
Forms are the most critical interactive bridge on the web. If a form is poorly structured, users won't be able to log in, purchase, or interact with your product.
In this lesson, we will create the semantic structure of two core screens: Login and Registration.
1. The Form Trinity: <form>, <label>, and <input>
The golden rule of accessibility and best practices: Every input must have an associated label via the for and id attributes.
html<form id="login-form" action="/login" method="POST"> <!-- Email Field --> <div class="form-group"> <label for="login-email">Email Address</label> <input type="email" id="login-email" name="email" placeholder="agent@nexus.io" required autocomplete="email" > </div> <!-- Password Field --> <div class="form-group"> <label for="login-password">Security Password</label> <input type="password" id="login-password" name="password" placeholder="••••••••••••" required minlength="8" > </div> <!-- Remember Me & Forgot Password --> <div class="form-options"> <label class="checkbox-label"> <input type="checkbox" name="remember"> Remember this device </label> <a href="#recover">Forgot password?</a> </div> <!-- Submit Button --> <button type="submit" class="btn-primary">Sign In</button> </form>
2. Modern HTML5 Validation Attributes
HTML5 includes powerful built-in validation without needing JavaScript:
required: The browser blocks submission if the field is empty.type="email": Checks that format contains@and a valid domain.minlength="8"andmaxlength="32": Restricts allowed character count.pattern="[0-9]{6}": Validates with Regular Expressions (e.g. 2FA pin).autocomplete="new-password": Helps password managers auto-suggest strong credentials.
3. Registration Form Structure
html<form id="register-form" action="/register" method="POST"> <div class="form-group"> <label for="reg-name">Full Name</label> <input type="text" id="reg-name" placeholder="Cipher Kane" required> </div> <div class="form-group"> <label for="reg-email">Corporate Email</label> <input type="email" id="reg-email" placeholder="c.kane@nexus.io" required> </div> <div class="form-group"> <label for="reg-password">Create Master Password</label> <input type="password" id="reg-password" minlength="8" required> </div> <div class="form-terms"> <label> <input type="checkbox" required> I agree to the <a href="#">Nexus Terms of Service</a> </label> </div> <button type="submit" class="btn-primary">Create Access Account</button> </form>
💡 Pro UX / Accessibility Tip
Never use placeholder as a replacement for <label>. Placeholders vanish once typing starts, causing users with memory or vision constraints to lose track of what field they were filling.
