Για να ελέγξετε την εμφάνιση της γραμματοσειράς μέσα σε ένα <input type="text"> (ή textarea, select), χρησιμοποιείτε CSS. Η σύγχρονη πρακτική είναι η χρήση class και εξωτερικό/εσωτερικό stylesheet, αλλά για γρήγορη δοκιμή λειτουργεί και το inline style attribute.
<input type="text" name="username"
style="font-family: 'Segoe UI', Tahoma, sans-serif;
font-size: 16px;
color: #333;
background-color: #f9f9f9;
border: 1px solid #ccc;
padding: 8px 12px;
border-radius: 4px;" />
<style>
.form-input {
font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
font-size: 1rem; /* 16px default */
color: #212529;
background-color: #fff;
border: 1px solid #ced4da;
padding: 0.5rem 0.75rem;
border-radius: 0.375rem;
transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
border-color: #86b7fe;
outline: 0;
box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}
</style>
<input type="text" name="email" class="form-input" placeholder="Email" />
| Ιδιότητα | Περιγραφή | Παράδειγμα |
|---|---|---|
font-family | Οικογένεια γραμματοσειράς (fallback list) | 'Arial', sans-serif |
font-size | Μέγεθος (px, rem, em, %) | 16px, 1rem |
font-weight | Πάχος (normal, bold, 400, 700) | 500 |
font-style | Πλάγια (italic, oblique) | italic |
color | Χρώμα κειμένου | #333, rgb(0,0,0) |
line-height | Ύψος γραμμής | 1.5 |
letter-spacing | Διάστημα γραμμάτων | 0.5px |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style> body { font-family: 'Inter', sans-serif; } </style>
::placeholder { color: #6c757d; }).font-family: monospace για κείμενο (εκτός αν κώδικας).Πνευματικά δικαιώματα © Γνώση Υπολογιστών Όλα τα δικαιώματα διατηρούνται.