CSS Formların CSS ile Biçimlendirilmesi

CSS kullanarak HTML form elemanlarını biçimlendirmek oldukça yaygındır. Aşağıda, farklı form elemanlarını biçimlendirmek için kullanılabilecek temel bir CSS örneği bulunmaktadır:

<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Form Biçimlendirme Örneği</title> <style> body { font-family: 'Arial', sans-serif; line-height: 1.6; margin: 0; padding: 0; background-color: #f4f4f4; color: #333; } section { padding: 2em; text-align: center; } form { max-width: 400px; margin: 0 auto; background-color: #fff; padding: 1em; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 0.5em; } input[type="text"], input[type="password"], select, textarea { width: 100%; padding: 0.5em; margin-bottom: 1em; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; } textarea { resize: vertical; } button { background-color: #4caf50; color: #fff; padding: 0.5em 1em; border: none; border-radius: 4px; cursor: pointer; } button:hover { background-color: #45a049; } </style> </head> <body> <section> <h1>Form Biçimlendirme Örneği</h1> <form> <label for="username">Kullanıcı Adı:</label> <input type="text" id="username" name="username"> <label for="password">Şifre:</label> <input type="password" id="password" name="password"> <label for="bio">Hakkında:</label> <textarea id="bio" name="bio" rows="4"></textarea> <label for="gender">Cinsiyet:</label> <select id="gender" name="gender"> <option value="male">Erkek</option> <option value="female">Kadın</option> </select> <button type="submit">Gönder</button> </form> </section> </body> </html>

Bu örnekte:

  • Formun genel tasarımı form etiketiyle belirlenmiştir. background-color, padding, border-radius, ve box-shadow gibi özellikler kullanılarak formun görünümü düzenlenmiştir.
  • input, select, ve textarea gibi form elemanları genişlik, padding, border-radius gibi özelliklerle düzenlenmiştir.
  • button etiketi için arkaplan renk, metin rengi, padding, border-radius gibi özellikler kullanılarak bir düğme tasarımı oluşturulmuştur.

Bu stil özelliklerini kullanarak form elemanlarını ihtiyacınıza göre özelleştirebilirsiniz.



Yorum Ekle

Üzerine gel