# Newsletter Signup

> An email field with the subscribe button tucked inside, plus a focus ring around the whole thing.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: newsletter, subscribe, email, input, button, inline
- Live preview: https://copy-css.com/snippets/newsletter-input
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<form class="subscribe">
  <input type="email" placeholder="you@example.com" aria-label="Email address" required>
  <button type="submit">Subscribe</button>
</form>
```

## CSS

```css
.subscribe {
  display: flex;
  width: 100%;
  max-width: 340px;
  padding: 5px;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.subscribe:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.subscribe input {
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #18181b;
  font: 15px system-ui, sans-serif;
}

.subscribe button {
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: #6366f1;
  color: #fff;
  font: 600 14px system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s ease;
}

.subscribe button:hover {
  background: #4f46e5;
}

.subscribe button:focus-visible {
  outline: 2px solid #312e81;
  outline-offset: 2px;
}
```

## Notes

- This CSS Newsletter Signup is 47 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses transitions, box shadows, Flexbox and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
