Photo by Markus Spiske on Unsplash
Search Form Neo Brutalism Design Using HTML and CSS
Create a modern, responsive search form design in the neo-brutalist style using HTML and CSS, featuring bold colors, thick borders, and heavy shadows for a raw, unpolished aesthetic. This implementation focuses on striking visuals, accessible design, and maintainable code, ideal for enabling users to search content in web interfaces.
Search
Find It
Prerequisites
- Basic HTML and CSS knowledge
- A code editor (e.g., VS Code)
Part 1: Search Form Neo Brutalism Design
Step 1: HTML Structure (index.html)
Create a semantic HTML structure for the neo-brutalist search form with a container, header, form with a text input and submit button, and a footer with a link.
<div class="neo-search-container" role="region" aria-label="Neo-brutalist search forms">
<div class="neo-search-wrapper" id="search-form-primary">
<div class="neo-search-header">
<h2>Search</h2>
</div>
<form class="neo-search-form" action="/search" method="get">
<input type="text" id="search-query-primary" name="q" class="neo-search-form-input" placeholder="Search for anything..." required aria-label="Search query" />
<button type="submit" class="neo-search-form-button">Search</button>
</form>
<div class="neo-search-footer">
Need help? <a href="#" aria-label="View search tips">Search Tips</a>
</div>
</div>
<div class="neo-search-wrapper secondary" id="search-form-secondary">
<div class="neo-search-header">
<h2>Find It</h2>
</div>
<form class="neo-search-form" action="/search" method="get">
<input type="text" id="search-query-secondary" name="q" class="neo-search-form-input" placeholder="Type your query..." required aria-label="Search query" />
<button type="submit" class="neo-search-form-button neo-search-find-it-form-button">Search</button>
</form>
<div class="neo-search-footer">
Explore more? <a href="#" aria-label="View advanced search options">Advanced Search</a>
</div>
</div>
</div>
Step 2: Core CSS Implementation (styles.css)
Style the search form and its elements with neo-brutalist aesthetics: bold colors, thick borders, heavy shadows, and a monospace font. Include Google Fonts for consistent typography.
:root {
--gray-900: #111827;
--gray-700: #374151;
--gray-300: #d1d5db;
--gray-100: #f3f4f6;
--white: #ffffff;
--primary-600: #2563eb;
--primary-500: #3b82f6;
--accent-500: #f59e0b;
--success-500: #10b981;
--error-500: #ef4444;
--pink-500: #ec4899;
--cyan-500: #06b6d4;
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 12px;
--spacing-lg: 16px;
--spacing-xl: 20px;
--radius-sm: 4px;
--radius-md: 6px;
--radius-lg: 12px;
--transition: 0.2s ease;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-neo: 4px 4px 0 var(--gray-900);
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--font-mono: 'IBM Plex Mono', monospace;
}
.neo-search-container {
display: flex;
flex-direction: column;
gap: var(--spacing-lg);
width: 100%;
max-width: 400px;
}
.neo-search-wrapper {
width: 360px;
padding: var(--spacing-lg);
background: var(--white);
border: 4px solid var(--gray-900);
box-shadow: var(--shadow-neo);
border-radius: var(--radius-lg);
}
.neo-search-wrapper.secondary {
border-color: var(--accent-500);
}
.neo-search-header {
margin-bottom: var(--spacing-lg);
text-align: center;
}
.neo-search-header h2 {
font-family: var(--font-mono);
font-size: 1.5rem;
margin: 0;
color: var(--gray-900);
}
.neo-search-form {
display: flex;
gap: var(--spacing-sm);
align-items: center;
}
.neo-search-form-input {
flex: 1;
padding: var(--spacing-sm);
border: 3px solid var(--gray-900);
background: var(--gray-100);
font-size: 0.875rem;
font-family: var(--font-mono);
border-radius: var(--radius-sm);
}
.neo-search-wrapper.secondary .neo-search-form-input {
border-color: var(--accent-500);
}
.neo-search-form-input:focus {
outline: none;
background: var(--gray-300);
border-color: var(--primary-600);
box-shadow: 2px 2px 0 var(--accent-500);
}
.neo-search-form-button {
padding: var(--spacing-sm) var(--spacing-lg);
background: var(--success-500);
color: var(--white);
font-family: var(--font-mono);
font-weight: 700;
font-size: 0.875rem;
border: 3px solid var(--gray-900);
cursor: pointer;
box-shadow: var(--shadow-neo);
transition: all var(--transition);
border-radius: var(--radius-sm);
}
.neo-search-wrapper.secondary .neo-search-form-button {
background: var(--pink-500);
border-color: var(--accent-500);
}
.neo-search-form-button:hover,
.neo-search-form-button:focus {
background: var(--white);
color: var(--success-500);
border-color: var(--success-500);
box-shadow: none;
transform: translate(2px, 2px);
}
.neo-search-wrapper.secondary .neo-search-form-button:hover,
.neo-search-wrapper.secondary .neo-search-form-button:focus {
color: var(--pink-500);
border-color: var(--pink-500);
}
.neo-search-form-button:focus {
outline: none;
box-shadow: 2px 2px 0 var(--accent-500), 0 0 0 3px var(--primary-600);
}
.neo-search-footer {
margin-top: var(--spacing-md);
text-align: center;
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--gray-700);
}
.neo-search-footer a {
color: var(--primary-600);
text-decoration: underline;
}
.neo-search-footer a:hover,
.neo-search-footer a:focus {
color: var(--primary-500);
}
.neo-search-footer a:focus {
outline: none;
box-shadow: 0 0 0 2px var(--accent-500);
}
.neo-search-find-it-form-button:hover{
color: var(--pink-500) !important;
background: var(--white) !important;
border-color: var(--pink-500) !important;
}
@media (max-width: 640px) {
.neo-search-container {
gap: var(--spacing-sm);
}
.neo-search-wrapper {
width: 100%;
max-width: 320px;
padding: var(--spacing-md);
}
.neo-search-header h2 {
font-size: 1.25rem;
}
.neo-search-form {
flex-direction: column;
gap: var(--spacing-sm);
}
.neo-search-form-input,
.neo-search-form-button {
font-size: 0.75rem;
width: 100%;
}
.neo-search-footer {
font-size: 0.6875rem;
}
}
Explanation
- Layout: The search form uses a flexbox container (
neo-search-container) to stack search wrappers (neo-search-wrapper) vertically. Each wrapper includes a header (neo-search-header), form (neo-search-form) with a text input (neo-search-form-input) and submit button (neo-search-form-button), and a footer (neo-search-footer) with a link, styled with a white background, thick borders, and heavy shadows. - Styling: The wrapper uses a white background with thick black (
4px) or orange (--accent-500for secondary) borders and a 4px shadow (--shadow-neo). The input and button have 3px borders, with the input using a gray background (--gray-100) and the button using green (--success-500) or pink (--pink-500). Text uses a monospace font (IBM Plex Mono). Hover/focus states invert button colors and remove shadows, while the input gains a blue border on focus. - Interactivity: The submit button (
neo-search-form-button) and footer link (neo-search-footer a) have hover and focus states that adjust colors and shadows. The input changes background on focus. No JavaScript is needed for this static design. - Visual Feedback: Hovering or focusing the button inverts colors (e.g., green to white, white to green) with a transform (
translate(2px, 2px)) and no shadow. The input grays out (--gray-300) and gains a blue border (--primary-600) with an orange shadow on focus. Focus states add a dual shadow (orange and blue) for accessibility. - Responsiveness: A media query (
@media (max-width: 640px)) adjusts wrapper width to 100% (max 320px), reduces padding and font sizes, and stacks the form elements vertically, maintaining the neo-brutalist aesthetic for mobile usability. - Accessibility:
role="region"andaria-labelon the container provide context for screen readers. The input hasaria-label="Search query", and the footer link hasaria-label(e.g.,View search tips). The form usesrequiredfor validation. High contrast ratios (4.5:1 minimum, verified for#10b981,#ec4899,#111827,#ffffff) and bold typography ensure readability. Buttons and inputs are keyboard-focusable with clear focus styles (dual shadow with--accent-500and--primary-600).
Accessibility Features
- Use
role="region"andaria-labelfor semantic structure - Include
aria-labelon inputs and links for screen readers - Ensure high contrast ratios for text, borders, and backgrounds (4.5:1 minimum)
- Support keyboard navigation with clear focus styles
- Use bold, readable typography (monospace for neo-brutalism)
Golden Rules
- Use CSS variables for consistent theming
- Implement bold borders and heavy shadows for neo-brutalist style
- Ensure accessibility with ARIA and descriptive attributes
- Optimize for mobile with responsive design
Conclusion
A professional neo-brutalist search form should embrace raw, bold aesthetics, provide clear user feedback, remain responsive, and follow accessibility guidelines. This solution uses HTML and CSS for striking search forms with primary and secondary variants, featuring heavy shadows, thick borders, a monospace font, and vibrant colors. Experiment with colors, shadow offsets, or add features like autocomplete or search filters. Test across devices and browsers for usability. Feel free to leave comments with any questions or suggestions!
Comments
Post a Comment