09-19-form-with-feedback.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Simple Form</title>
  6. <style>
  7. body {
  8. font-family: "Myriad Pro", Frutiger, "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", Verdana, sans-serif;
  9. background-color: #edf5f8;
  10. padding: 20px;
  11. }
  12. input,
  13. textarea {
  14. font: inherit;
  15. }
  16. fieldset {
  17. border: 0;
  18. padding: 0.01em 0 0 0;
  19. margin: 0;
  20. }
  21. .fieldset-wrapper {
  22. padding: 1em;
  23. margin-bottom: 1em;
  24. border: 1px solid #eee; /* mostly for IE8 */
  25. background-color: #fff;
  26. box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
  27. }
  28. /**
  29. * No border for more modern browsers.
  30. */
  31. :root .fieldset-wrapper {
  32. border: 0;
  33. }
  34. legend {
  35. padding: 0 0 .5em 0;
  36. font-weight: bold;
  37. color: #777;
  38. }
  39. label {
  40. cursor: pointer;
  41. }
  42. .field-text label {
  43. display: block;
  44. }
  45. .field-text label,
  46. .field-text input,
  47. .field-text .form-help,
  48. .field-text textarea {
  49. width: 100%;
  50. max-width: 20em;
  51. -moz-box-sizing: border-box;
  52. box-sizing: border-box;
  53. }
  54. .field-text input,
  55. .field-text textarea {
  56. padding: .375em .3125em .3125em;
  57. border: 1px solid #ccc;
  58. border-radius: .25em;
  59. }
  60. .field-text :focus {
  61. outline: 0;
  62. box-shadow: 0 0 .5em rgba(93, 162, 248, 0.5);
  63. border-color: #5da2f8;
  64. }
  65. .field-text :invalid {
  66. border-color: #e72633;
  67. box-shadow: 0 0 .5em rgba(229, 43, 37, 0.5);
  68. }
  69. textarea {
  70. height: 10em;
  71. resize: vertical;
  72. }
  73. input[type="radio"] {
  74. margin-right: .75em;
  75. }
  76. button {
  77. cursor: pointer;
  78. border: 0;
  79. padding: .5em 1em;
  80. color: #fff;
  81. border-radius: .25em;
  82. font-size: 1em;
  83. background-color: #173b6d;
  84. background-image: -webkit-linear-gradient(top, #1a4a8e, #173b6d);
  85. background-image: linear-gradient(to bottom, #1a4a8e, #173b6d);
  86. box-shadow: 0 .25em 0 rgba(23, 59, 109, 0.3), inset 0 1px 0 rgba(0, 0, 0, 0.3);
  87. }
  88. .field-submit {
  89. padding: 1em;
  90. }
  91. .form-help {
  92. display: block;
  93. /* hide the help by default,
  94. without hiding it from screen readers */
  95. position: absolute;
  96. overflow: hidden;
  97. width: 1px;
  98. height: 1px;
  99. clip: rect(0, 0, 0, 0);
  100. }
  101. input:focus + .form-help {
  102. padding: .5em;
  103. margin-top: .5em;
  104. border: 1px solid #e1de8a;
  105. border-radius: .25em;
  106. font-style: italic;
  107. color: #737373;
  108. background-color: #fff;
  109. position: static;
  110. width: auto;
  111. height: auto;
  112. crop: none;
  113. }
  114. ::-webkit-input-placeholder {
  115. font-style: italic;
  116. }
  117. :-ms-input-placeholder {
  118. font-style: italic;
  119. }
  120. ::-moz-placeholder {
  121. font-style: italic;
  122. }
  123. </style>
  124. </head>
  125. <body>
  126. <h1>Leave a comment</h1>
  127. <form id="comments_form" action="/comments/" method="post">
  128. <div class="fieldset-wrapper">
  129. <fieldset>
  130. <legend>Your Contact Details</legend>
  131. <p class="field field-text">
  132. <label for="comment-author">Name:</label>
  133. <input name="comment-author" required id="comment-author" type="text" />
  134. </p>
  135. <p class="field field-text">
  136. <label for="comment-email">Email Address:</label>
  137. <input name="comment-email" required id="comment-email" type="email" />
  138. </p>
  139. <p class="field field-text">
  140. <label for="comment-url">Web Address:</label>
  141. <input name="comment-url" aria-describedby="comment-url-help" id="comment-url" type="url" placeholder="http://example.com" />
  142. <span id="comment-url-help" role="tooltip" class="form-help">Fill in your URL if you have one. Make sure to include the ”http://”-part.</span>
  143. </p>
  144. </fieldset>
  145. </div>
  146. <div class="fieldset-wrapper">
  147. <fieldset>
  148. <legend>Comments</legend>
  149. <p class="field field-text">
  150. <label for="comment-text">Message:</label>
  151. <textarea name="comment-text" id="comment-text" cols="20" rows="10"></textarea>
  152. </p>
  153. </fieldset>
  154. </div>
  155. <div class="fieldset-wrapper">
  156. <fieldset>
  157. <legend>Remember Me</legend>
  158. <p class="field">
  159. <label><input name="remember" type="radio" value="yes" />Yes</label>
  160. </p>
  161. <p class="field">
  162. <label>
  163. <input name="remember" type="radio" value="no" checked="checked" />No</label>
  164. </p>
  165. </fieldset>
  166. </div>
  167. <p class="field-submit">
  168. <button id="submit" class="submit" name="submit" type="submit">Post comment</button>
  169. </p>
  170. </form>
  171. </body>
  172. </html>