element_label.rml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <rml>
  2. <head>
  3. <title>Element &lt;label&gt;</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#the-label-element" />
  6. <meta name="Description" content="The label element. Pay attention to the hover and active states, and that the target is clicked when its label is clicked." />
  7. <style>
  8. @spritesheet theme
  9. {
  10. src: /assets/invader.tga;
  11. invader: 179px 152px 50px 40px;
  12. }
  13. body {
  14. font-size: 16dp;
  15. }
  16. input, button {
  17. margin: 0 1em;
  18. }
  19. label {
  20. cursor: pointer;
  21. }
  22. label:hover {
  23. color: #ff3;
  24. }
  25. input:focus, button:focus {
  26. border-color: #3af;
  27. }
  28. input.checkbox, input.radio {
  29. width: 1.2em;
  30. height: 1.2em;
  31. vertical-align: middle;
  32. }
  33. button {
  34. display: inline-block;
  35. background: #aaa;
  36. border: 1dp #333;
  37. padding: 0.5em 1em;
  38. tab-index: auto;
  39. }
  40. button:hover {
  41. color: #333;
  42. background: #cca;
  43. }
  44. button:active {
  45. background: #eec;
  46. }
  47. label.float {
  48. display: inline-block;
  49. float: left;
  50. background-color: #ddd;
  51. border-radius: 1em;
  52. padding: 0.5em;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <p>
  58. <label><input type="checkbox"/> Pizza</label>
  59. </p>
  60. <p>
  61. <input type="checkbox" id="pasta"/><label for="pasta"> Pasta</label>
  62. </p>
  63. <p>
  64. <label id="my_label" for="my_label">
  65. <input type="checkbox"/> Self referenced label (invalid)
  66. </label>
  67. </p>
  68. <p>
  69. <label>Left<input type="checkbox"/> Right</label>
  70. </p>
  71. <p>
  72. <label for="sandwich">Left</label><input type="checkbox" id="sandwich"/><label for="sandwich"> Right</label>
  73. </p>
  74. <h1><label for="name">Name</label></h1>
  75. <p>
  76. <input style="width: 50%;" type="text" id="name"/>
  77. </p>
  78. <label class="float">
  79. <button id="submit">Submit</button>
  80. <p>
  81. Press button from many places.<img sprite="invader"/><br/>
  82. Even here...
  83. </p>
  84. </label>
  85. <label class="float" style="float: right;" for="submit">
  86. ...or here.
  87. </label>
  88. </body>
  89. </rml>