🧪 Frontend Lab
交互式前端学习实验室

表单样式设计

css · intermediate · 25-30 min · Step 1/5

CSS 表单美化

Input 样式

input {
  appearance: none;          /* 移除浏览器默认样式 */
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder {
  color: #999;
}

Label 最佳实践

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
始终用 关联 input,提升可访问性。