HTML: Forms and Tables
Tables: TR, TD, and TH element
- TR: The Table Row element
- TD: The Table Data Cell element
- TH: The Table Header element
TR: Table Row
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
TD: Table Data
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
TH: Table Header
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
Tables: Thead, Tbody and Tfoot Elements
- Thead: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
- Tbody: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
- Tfoot: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot
Tables: Colspan and Rowspan
1 | <table> |
Coding Excersice
1 |
|
The Form Element
Creating Forms
- The
<form>
element itself is a shell of container that doesn’t have any visual impact. - We then fill the form with a collection of inputs, checkboxes, buttons, etc.
<form>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
- The form element represents a document section containing interactive contorls for submitting information.
- The action attribute specifies WHERE the form data should be sent
- The method attribute specifies which HTTP method should be used
<input>
Common Input Types
- The input element is used to create a variety of different form controls
- We have 20+ possible types of inputs ranging from data pickers to checkboxes.
- The type attribute is where the magic happens. Changing type dramatically alters the input’s behavior and appearance
1 | <form action="/tacos"> |
The All-important Label label
https://developer.mozilla.org/en-US/search?q=label
The
1 | <div class="preference"> |
HTML Buttons
The
<button>
HTML element represents a clickable button, used to submit forms or anywhere in a document for accessible, standard button functionality.
By default, button
hold a type="submit"
but if you want the button do not submit a form, you can do <button type="button">
1 | <button class="favorite styled" |
alternative
1 | <input type="submit"> |
The name Attribute
We should put it on every single input that you use and it will be used when you send your data to a server eventually.
Note that the webpage url changed after submitting the form.
Demo of Hijacking Google and Reddit Search
1 | <form action="https://www.reddit.com/search"> |
Radio Buttons, Checkboxes, & Selects
Checkboxes
1 | <form action="/birds"> |
Radio Buttons
1 | <p> |
1 | <p> |
Range & Text Area
Range
1 | <p> |
Text Area
1 | <p> |