Introduction

HTML5 has been with us for a while now, roughly ten years. And, it hasn't really seen a major update. Sure there's XHTML, but that did little more than make things slightly stricter - making you write better quality code if you were at all concerned with compliance. HTML 5 does more than that. For one thing, it adds a few new features. Not a huge amount, but the ones that it does add are very useful.
Work on HTML 5 started way back in 2004, and now it's starting to get interesting. Browser support is increasing, and the element I'm most interested in - CANVAS - is supported by four out of the major five browsers. It is, however, not really feasible to use it since MSIE doesn't have any support for it.
Step 1: Open Macromedia Dreamweaver
Click Start button -> Macromedia Dreamweaver
startBar.jpg
Step 2: Create a new document Click File Menu -> New Document
Click the Create button.
newdocument.jpg
Step 3:- HTML 5 Doctype:
  1. <!DOCTYPE html>
  2. <html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset=utf-8 />
  5. <title>Title </title>
  6. </head>
  7. <body>
  8. Create Text here
  9. </body>
  10. </html>
Step 4: Define the body part and set the content of the Payment form.
Code
  1. <h1>Payment form</h1>
  2. <form id=payment>
  3. <fieldset>
  4. <legend>Your details</legend>
  5. <ol>
  6. <li>
  7. <label for=name>Name</label>
  8. <input id=name namename=name type=text placeholder="First and last name" required autofocus>
  9. </li>
  10. <li>
  11. <label for=email>Email</label>
  12. <input id=email name=email type=email placeholder="[email protected]" required>
  13. </li>
  14. <li>
  15. <label for=phone>Phone</label>
  16. <input id=phone name=phone type=tel placeholder="Eg. +447500000000" required>
  17. </li>
  18. </ol>
  19. </fieldset>
  20. <fieldset>
  21. <legend>Delivery address</legend>
  22. <ol>
  23. <li>
  24. <label for=address>Address</label>
  25. <textarea id=address name=address rows=5 required>
  26. <li>
  27. <label for="postcode">Post code</label>
  28. <input id="postcode" name="postcode" type="text" required="">
  29. </li>
  30. <li>
  31. <label for="country">Country</label>
  32. <input id="country" name="country" type="text" required="">
  33. </li>
  34. <fieldset>
  35. <legend>Card details</legend>
  36. <ol>
  37. <li>
  38. <fieldset>
  39. <legend>Card type</legend>
  40. <ol>
  41. <li>
  42. <input id="visa" name="cardtype" type="radio">
  43. <label for="visa">VISA</label>
  44. </li>
  45. <li>
  46. <input id="amex" name="cardtype" type="radio">
  47. <label for="amex">AmEx</label>
  48. </li>
  49. <li>
  50. <input id="mastercard" name="cardtype" type="radio">
  51. <label for="mastercard">Mastercard</label>
  52. </li>
  53. </ol>
  54. </fieldset>
  55. </li>
  56. <li>
  57. <label for="cardnumber">Card number</label>
  58. <input id="cardnumber" name="cardnumber" type="number" required="">
  59. </li>
  60. <li>
  61. <label for="secure">Security code</label>
  62. <input id="secure" name="secure" type="number" required="">
  63. </li>
  64. <li>
  65. <label for="namecard">Name on card</label>
  66. <input id="namecard" name="namecard" type="text" placeholder="Exact name as on the card" required="">
  67. </li>
  68. </ol>
  69. </fieldset>
  70. <fieldset>
  71. <button type="submit">Submit</button>
  72. </fieldset>
Step 5: Apply the Stylesheet of the form Code
  1. <style>
  2. html, body, h1, form, fieldset, legend, ol, li {
  3. margin: 0;
  4. padding: 0;
  5. }
  6. body {
  7. background: #ffffff;
  8. color: #111111;
  9. font-family: Georgia, "Times New Roman", Times, serif;
  10. padding: 20px;
  11. }
  12. h1 {
  13. font-size: 28px;
  14. margin-bottom: 20px;
  15. }
  16. form#payment {
  17. background: #9cbc2c;
  18. -moz-border-radius: 5px;
  19. -webkit-border-radius: 5px;
  20. -khtml-border-radius: 5px;
  21. border-radius: 5px;
  22. counter-reset: fieldsets;
  23. padding: 20px;
  24. width: 400px;
  25. }
  26. form#payment fieldset {
  27. border: none;
  28. margin-bottom: 10px;
  29. }
  30. form#payment fieldset:last-of-type {
  31. margin-bottom: 0;
  32. }
  33. form#payment legend {
  34. color: #384313;
  35. font-size: 16px;
  36. font-weight: bold;
  37. padding-bottom: 10px;
  38. text-shadow: 0 1px 1px #c0d576;
  39. }
  40. form#payment > fieldset > legend:before {
  41. content: "Step " counter(fieldsets) ": ";
  42. counter-increment: fieldsets;
  43. }
  44. form#payment fieldset fieldset legend {
  45. color: #111111;
  46. font-size: 13px;
  47. font-weight: normal;
  48. padding-bottom: 0;
  49. }
  50. form#payment ol li {
  51. background: #b9cf6a;
  52. background: rgba(255,255,255,.3);
  53. border-color: #e3ebc3;
  54. border-color: rgba(255,255,255,.6);
  55. border-style: solid;
  56. border-width: 2px;
  57. -moz-border-radius: 5px;
  58. -webkit-border-radius: 5px;
  59. -khtml-border-radius: 5px;
  60. border-radius: 5px;
  61. line-height: 30px;
  62. list-style: none;
  63. padding: 5px 10px;
  64. margin-bottom: 2px;
  65. }
  66. form#payment ol ol li {
  67. background: none;
  68. border: none;
  69. float: left;
  70. }
  71. form#payment label {
  72. float: left;
  73. font-size: 13px;
  74. width: 110px;
  75. }
  76. form#payment fieldset fieldset label {
  77. background: none no-repeat left 50%;
  78. line-height: 20px;
  79. padding: 0 0 0 30px;
  80. width: auto;
  81. }
  82. form#payment label[for=visa] {
  83. background-image: url(visa.gif);
  84. }
  85. form#payment label[for=amex] {
  86. background-image: url(amex.gif);
  87. }
  88. form#payment label[for=mastercard] {
  89. background-image: url(mastercard.gif);
  90. }
  91. form#payment fieldset fieldset label:hover {
  92. cursor: pointer;
  93. }
  94. form#payment input:not([type=radio]),form#payment textarea {
  95. background: #ffffff;
  96. border: none;
  97. -moz-border-radius: 3px;
  98. -webkit-border-radius: 3px;
  99. -khtml-border-radius: 3px;
  100. border-radius: 3px;
  101. font: italic 13px Georgia, "Times New Roman", Times, serif;
  102. outline: none;
  103. padding: 5px;
  104. width: 200px;
  105. }
  106. form#payment input:not([type=submit]):focus,form#payment textarea:focus {
  107. background: #eaeaea;
  108. }
  109. form#payment input[type=radio] {
  110. float: left;
  111. margin-right: 5px;
  112. }
  113. form#payment button {
  114. background: #384313;
  115. border: none;
  116. -moz-border-radius: 20px;
  117. -webkit-border-radius: 20px;
  118. -khtml-border-radius: 20px;
  119. border-radius: 20px;
  120. color: #ffffff;
  121. display: block;
  122. font: 18px Georgia, "Times New Roman", Times, serif;
  123. letter-spacing: 1px;
  124. margin: auto;
  125. padding: 7px 25px;
  126. text-shadow: 0 1px 1px #000000;
  127. text-transform: uppercase;
  128. }
  129. form#payment button:hover {
  130. background: #1e2506;
  131. cursor: pointer;
  132. }
  133. </style>
Step 6: Write the complete code for the developed simple Payment form that uses the HTML 5 tools. The complete application is given below.
Code:
  1. <!DOCTYPE html>
  2. <html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset=utf-8 />
  5. <title>Form HTML 5 </title>
  6. <style>
  7. html, body, h1, form, fieldset, legend, ol, li {
  8. margin: 0;
  9. padding: 0;
  10. }
  11. body {
  12. background: #ffffff;
  13. color: #111111;
  14. font-family: Georgia, "Times New Roman", Times, serif;
  15. padding: 20px;
  16. }
  17. h1 {
  18. font-size: 28px;
  19. margin-bottom: 20px;
  20. }
  21. form#payment {
  22. background: #9cbc2c;
  23. -moz-border-radius: 5px;
  24. -webkit-border-radius: 5px;
  25. -khtml-border-radius: 5px;
  26. border-radius: 5px;
  27. counter-reset: fieldsets;
  28. padding: 20px;
  29. width: 400px;
  30. }
  31. form#payment fieldset {
  32. border: none;
  33. margin-bottom: 10px;
  34. }
  35. form#payment fieldset:last-of-type {
  36. margin-bottom: 0;
  37. }
  38. form#payment legend {
  39. color: #384313;
  40. font-size: 16px;
  41. font-weight: bold;
  42. padding-bottom: 10px;
  43. text-shadow: 0 1px 1px #c0d576;
  44. }
  45. form#payment > fieldset > legend:before {
  46. content: "Step " counter(fieldsets) ": ";
  47. counter-increment: fieldsets;
  48. }
  49. form#payment fieldset fieldset legend {
  50. color: #111111;
  51. font-size: 13px;
  52. font-weight: normal;
  53. padding-bottom: 0;
  54. }
  55. form#payment ol li {
  56. background: #b9cf6a;
  57. background: rgba(255,255,255,.3);
  58. border-color: #e3ebc3;
  59. border-color: rgba(255,255,255,.6);
  60. border-style: solid;
  61. border-width: 2px;
  62. -moz-border-radius: 5px;
  63. -webkit-border-radius: 5px;
  64. -khtml-border-radius: 5px;
  65. border-radius: 5px;
  66. line-height: 30px;
  67. list-style: none;
  68. padding: 5px 10px;
  69. margin-bottom: 2px;
  70. }
  71. form#payment ol ol li {
  72. background: none;
  73. border: none;
  74. float: left;
  75. }
  76. form#payment label {
  77. float: left;
  78. font-size: 13px;
  79. width: 110px;
  80. }
  81. form#payment fieldset fieldset label {
  82. background: none no-repeat left 50%;
  83. line-height: 20px;
  84. padding: 0 0 0 30px;
  85. width: auto;
  86. }
  87. form#payment label[for=visa] {
  88. background-image: url(visa.gif);
  89. }
  90. form#payment label[for=amex] {
  91. background-image: url(amex.gif);
  92. }
  93. form#payment label[for=mastercard] {
  94. background-image: url(mastercard.gif);
  95. }
  96. form#payment fieldset fieldset label:hover {
  97. cursor: pointer;
  98. }
  99. form#payment input:not([type=radio]),
  100. form#payment textarea {
  101. background: #ffffff;
  102. border: none;
  103. -moz-border-radius: 3px;
  104. -webkit-border-radius: 3px;
  105. -khtml-border-radius: 3px;
  106. border-radius: 3px;
  107. font: italic 13px Georgia, "Times New Roman", Times, serif;
  108. outline: none;
  109. padding: 5px;
  110. width: 200px;
  111. }
  112. form#payment input:not([type=submit]):focus,
  113. form#payment textarea:focus {
  114. background: #eaeaea;
  115. }
  116. form#payment input[type=radio] {
  117. float: left;
  118. margin-right: 5px;
  119. }
  120. form#payment button {
  121. background: #384313;
  122. border: none;
  123. -moz-border-radius: 20px;
  124. -webkit-border-radius: 20px;
  125. -khtml-border-radius: 20px;
  126. border-radius: 20px;
  127. color: #ffffff;
  128. display: block;
  129. font: 18px Georgia, "Times New Roman", Times, serif;
  130. letter-spacing: 1px;
  131. margin: auto;
  132. padding: 7px 25px;
  133. text-shadow: 0 1px 1px #000000;
  134. text-transform: uppercase;
  135. }
  136. form#payment button:hover {
  137. background: #1e2506;
  138. cursor: pointer;
  139. }
  140. </style>
  141. </head>
  142. <body>
  143. <h1>Payment form</h1>
  144. <form id=payment>
  145. <fieldset>
  146. <legend>Your details</legend>
  147. <ol>
  148. <li>
  149. <label for=name>Name</label>
  150. <input id=name namename=name type=text placeholder="First and last name" required autofocus>
  151. </li>
  152. <li>
  153. <label for=email>Email</label>
  154. <input id=email name=email type=email placeholder="[email protected]" required>
  155. </li>
  156. <li>
  157. <label for=phone>Phone</label>
  158. <input id=phone name=phone type=tel placeholder="Eg. +447500000000" required>
  159. </li>
  160. </ol>
  161. </fieldset>
  162. <fieldset>
  163. <legend>Delivery address</legend>
  164. <ol>
  165. <li>
  166. <label for=address>Address</label>
  167. <textarea id=address name=address rows=5 required>
  168. <li>
  169. <label for="postcode">Post code</label>
  170. <input id="postcode" name="postcode" type="text" required="">
  171. </li>
  172. <li>
  173. <label for="country">Country</label>
  174. <input id="country" name="country" type="text" required="">
  175. </li>
  176. <fieldset>
  177. <legend>Card details</legend>
  178. <ol>
  179. <li>
  180. <fieldset>
  181. <legend>Card type</legend>
  182. <ol>
  183. <li>
  184. <input id="visa" name="cardtype" type="radio">
  185. <label for="visa">VISA</label>
  186. </li>
  187. <li>
  188. <input id="amex" name="cardtype" type="radio">
  189. <label for="amex">AmEx</label>
  190. </li>
  191. <li>
  192. <input id="mastercard" name="cardtype" type="radio">
  193. <label for="mastercard">Mastercard</label>
  194. </li>
  195. </ol>
  196. </fieldset>
  197. </li>
  198. <li>
  199. <label for="cardnumber">Card number</label>
  200. <input id="cardnumber" name="cardnumber" type="number" required="">
  201. </li>
  202. <li>
  203. <label for="secure">Security code</label>
  204. <input id="secure" name="secure" type="number" required="">
  205. </li>
  206. <li>
  207. <label for="namecard">Name on card</label>
  208. <input id="namecard" name="namecard" type="text" placeholder="Exact name as on the card" required="">
  209. </li>
  210. </ol>
  211. </fieldset>
  212. <fieldset>
  213. <button type="submit">Submit</button>
  214. </fieldset>
Output:
output.jpg