Overview
The DNI Cita Previa redesign is a static HTML/CSS/JavaScript project with a clean, organized structure. The project uses vanilla web technologies without any build tools or frameworks, making it lightweight and easy to deploy.Directory Structure
File Organization
HTML Pages
The project consists of four main pages that form the user journey:Homepage (index.html)
Entry point with two main options:
- Iniciar Solicitud de Cita (Start appointment request)
- Anular/Consultar Cita (Cancel/check appointment)
source/index.htmlStart Request (iniciar-solicitud.html)
Authentication method selection:
- With DNI/NIE data
- With electronic certificate (Cl@ve)
source/iniciar-solicitud.htmlSelect Appointment (seleccionar-cita.html)
Comprehensive form collecting:
- Type of procedure (DNI, Passport, or both)
- DNI data (number, expedition team, validity date, support number)
- Appointment details (province, office, date, time)
- Contact information (email, phone, observations)
- Renewal reason (expiration, loss, deterioration, etc.)
source/seleccionar-cita.htmlCSS Architecture
The styles are split across multiple files following a component-based approach:| File | Purpose | Used By |
|---|---|---|
style.css | Global styles, CSS variables, reset, base layout | All pages |
headerfooter.css | Header and footer components | All pages |
index.css | Homepage-specific styles for option cards | index.html |
iniciar-solicitud.css | Authentication option cards | iniciar-solicitud.html |
seleccionar-cita.css | Form styling, input fields, buttons | seleccionar-cita.html |
resumen.css | Summary tables, status badge, action buttons | resumen.html |
JavaScript Files
The project uses minimal JavaScript:js/index.js (13 lines)
- Handles mobile navigation menu toggle
- Adds/removes
visible-navclass on button click - Shared across all pages
Image Assets
The project implements modern image optimization using the<picture> element:
Format Priority:
- AVIF (best compression, modern browsers)
- WebP (good compression, wide support)
- PNG/JPEG (fallback for older browsers)
Component Structure
All pages share common components:Header Component
- Yellow background (
--header-yellow) - Ministry logo (responsive picture element)
- Desktop navigation menu
- Mobile hamburger menu (displays at ≤480px)
- Links: Inicio, Ayuda, Aviso legal, Accesibilidad, Mapa Web
Footer Component
- Dark background (
--footer-background-blue) - Three-column layout (desktop) / stacked (mobile)
- National Police logo
- Enlaces de interés (Links of interest)
- Contacto y ayuda (Contact and help)
- Copyright notice
Main Content Container
- Max-width: 900px
- Centered layout
- Responsive padding on tablets and smaller
Info Boxes
All pages include information boxes with:- Light blue background (
--bg-blue-light) - Info icon (SVG)
- Important contextual information
- Consistent styling via
.infoclass
Page-Specific Components
Homepage Components
Option Cards (css/index.css:1-69)
- Two-column layout (stacks on mobile)
- Primary action (blue button) + secondary action (gray button)
- SVG icons inline
- Hover effects (opacity and scale)
Form Components
Form Sections (css/seleccionar-cita.css:9-23)
- Section headings with icons
- Bottom border separators
- Organized field groups
css/seleccionar-cita.css:40-88)
- 2px border with focus states
- Blue focus ring
- Validation styling for invalid inputs
- Consistent 12px padding
css/seleccionar-cita.css:29-38)
- Flexbox-based responsive grid
- Automatic wrapping on smaller screens
- 20px gap between fields
Summary Components
Status Badge (css/resumen.css:10-44)
- Gradient background (light blue)
- Success icon (green checkmark SVG)
- Reference code display
- Centered layout
css/resumen.css:73-104)
- Two-column key-value layout
- 35% width for labels, 65% for values
- Bottom borders between rows
- Strong emphasis on values
Deployment
This is a static site with no build process required.HTML Structure Pattern
All pages follow a consistent structure:Best Practices
Semantic HTML
Uses proper HTML5 elements:
<header>, <main>, <footer>, <nav>, <section>Accessibility
- Proper alt text on images
- Semantic form labels
- ARIA-friendly navigation
Performance
- Modern image formats
- Minimal JavaScript
- No external dependencies
Responsive Design
- Mobile-first breakpoints
- Flexible layouts
- Touch-friendly targets
Next Steps
Styling Guide
Learn about the CSS architecture and custom properties system
Customization
Customize colors, fonts, layout, and content