About this snippet

Modernize your forms with this drag-and-drop file upload area. It uses a dashed border and a large icon to clearly indicate where users should place their files, which improves usability.

Size
1.3 KB
Uses
HTML, CSS
Loads
Nothing external
Views
390
<div class="upload-area">
  <input type="file" id="fileInput" hidden>
  <label for="fileInput" class="upload-label">
    <div class="icon">&#128193;</div>
    <h3>Click or Drag & Drop</h3>
    <p>Supported formats: JPG, PNG, PDF</p>
    <span class="browse-btn">Browse Files</span>
  </label>
</div>
.upload-area {
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  width: 100%;
  max-width: 400px;
}
.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border: 2px dashed #d1d5db;
  border-radius: 16px;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  text-align: center;
}
.upload-label:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.icon {
  font-size: 3rem;
  margin-bottom: 15px;
  color: #9ca3af;
}
.upload-label h3 {
  margin: 0 0 5px 0;
  color: #1f2937;
}
.upload-label p {
  margin: 0 0 20px 0;
  font-size: 0.85rem;
  color: #6b7280;
}
.browse-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s;
}
.upload-label:hover .browse-btn {
  border-color: #3b82f6;
  color: #3b82f6;
}
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save