Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Forms › Styled contact form
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> form { max-width: 340px; font-family: Arial, sans-serif; } label { display: block; margin: 10px 0 4px; font-weight: bold; } input, textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #bbb; border-radius: 6px; font: inherit; } input:focus, textarea:focus { outline: none; border-color: #4a90e2; box-shadow: 0 0 0 3px rgba(74,144,226,.3); } input:invalid:not(:placeholder-shown) { border-color: crimson; } button { margin-top: 12px; width: 100%; padding: 10px; background: #1f386b; color: white; border: none; border-radius: 6px; cursor: pointer; } button:hover { background: #2d4f94; } </style> <form> <label for="n">Name</label> <input id="n" placeholder="Your name"> <label for="e">Email</label> <input id="e" type="email" placeholder="you@example.com"> <label for="m">Message</label> <textarea id="m" rows="3"></textarea> <button type="button">Send</button> </form>
Result