The document discusses various HTML elements for tables, forms, block quotes, and preformatted text. It provides examples of how to implement these elements using markup. For tables, it covers the <table>, <tr>, <td>, <th>, <thead>, <tbody>, <tfoot> elements as well as rowspan and colspan attributes. For forms, it discusses the <form>, <fieldset>, <legend>, <label>, <input>, <textarea>, <select> elements. It also provides references for further reading on HTML and CSS.
22. <fieldset> and <legend> The fieldset element is used to indicate a logical group of form controls. A fieldset may also include a legend element that provides a caption for the fields it wraps.
23. <label> This element is used to link up descriptive text with a form field like an input element. It's fundamental to making your forms accessible.
27. <input type="submit" /> By using the type of submit, this control looks like a button. When clicked, the submit button immediately sends the collected form data to the server for processing.
30. <textarea>...</textarea> This one is a multi-line, scrollable text entry box. You see it many places - like our competition forms for example.
31. <input type="radio" /> By giving them the same "name" attribute in groups, you can have a group of radio buttons restricted to a single choice. <input type="radio" name="vote" value="a" /> <input type="radio" name="vote" value="b" /> <input type="radio" name="vote" value="c" />
32. <input type="checkbox" /> For single or multiple selections. We commonly use these to get visitors to indicate that they have read our terms and conditions. <input type="checkbox" name="t-and-c"checked="checked" />
33. <select><option>... The select element, which contains option elements, displays as a pull-down menu by default when no size is specified or if the size attribute is set to 1. In pull-down menus, only one item may be selected
35. <p> Renowned type designer, Matthew Carter, has this to say about his profession: </p> <blockquote> <p> Our alphabet hasn't changed in eons; there isn't much latitude in what a designer can do with the individual letters. </p> <p> Much like a piece of classical music, the score is written down – it’s not something that is tampered with – and yet, each conductor interprets that score differently. There is tension in the interpretation. </p> </blockquote>
36. preformatted text We told you browsers ignore white space between elements in html right? What if we wanted to keep the whitespace, like tabs and spaces... intact?
37. Wrap it in the <pre> ... </pre> tags,and you let the browser know that it's preformatted!
39. more references http://www.htmldog.com/guides/ - Guides on best practice web stuff. http://www.w3schools.com/tags/default.asp - The XHTML tag references. http://www.w3schools.com/css/css_reference.asp - The CSS property references.
During your travels in the world of HTML/XHTML and CSS - you'll encounter lots more tags than you'll probably care to know about. Because we're pretty nice, we'll show you what some of the more common ones are, so you know what they do, and how to handle them when you make edits.
Tables are very useful to markup because the data suddenly gets structure and meaning rather than being listed out. We can organise data into rows of columns, and add in headings and captions to make columns have marked up sense. If you understand the purpose of a spreadsheet - you've already been sold on tables!
In the old days, there wasn't a good reliable way to do layout on the web - If you wanted some columns under a header for example, you would have to create a table with fixed dimensions for the cells, and then hide the borders or backgrounds so the table itself is invisible. IT'S HORRIBLE. NEVER DO THIS IF YOU CAN AVOID IT. Tables imply a semantic relationship just like other elements. Putting things in them, makes them tablular data, and distorts the meaning of your content if you use it for layout purposes.
This is a fully defined table. It has two rows (<tr>) - the first containing two headings (<th>), and the second containing two cells (<td>).That gives us...
But remember the way it looks......is controlled by the stylesheet!!Lets have a look at how these elements create a table structure:
<tr> elements are row containers. All they exist for, is to contain <td> elements, much like the <ul> or <ol>list elements do. They still have semantic purpose of course, as they group rows of those <td> cell elements. <th> elements are heading cells and <td> elements are regular cells.With both of these, you can specify the alignment of the content inside of them with some of their attributes,align="" for horizontal alignment of contents, and valign="" for vertical alignment. There are many intricate ways of referencing and nesting cells.
Want a row or column to be one cell, spanning over the space where normally other cells would be? You need the colspan and rowspan attributes for <td> elements! <td rowspan="3"> - this cellwill eat up a cell one row down to become one larger cell. Remove 3 extra <td>(cells) from other <tr> (rows).<td colspan="4"> - this cell will eat up 4 cells across to become one larger cell. Remove 3 <th> (cells) on this <tr> (row).<th colspan="4"> - this heading cell will eat up 4 cells across to become one larger cell. Remove 3 <th>(heading cells) on this <tr> (row).Let’s look at these in action:
More detail on these is in the article on the Wiki
If it ever comes to this point though, you're best to get the front-end developers to help sort this out for you! :-)
Forms are quite out of the scope of this initial course, but you should be able to understand and identify them in markup.There are two parts to normal forms. The first part is the form that you see on the page itself - buttons, text fields, and pull-down menus (together known as form controls) used to collect info from the user, but can also some regular html text elements. The other part of a web form is the programming or script on the server that processes the info in the form and returns a useful reply. That will handle all the logic. In other words, you can't just put up an (X)HTML page with form elements - we need progamming know-how of backend developers.
Awesomely becomes:
It is current best practice to wrap form controls in lists, most commonly ordered lists as shown in this example. Not only is it semantically correct, it also makes it easier to format the form with style sheets later.Some of the elements can be explained as:
A type of "password" masks the input text with dots. It's multipurpose!
You could also use the type of "reset" and it would be a button that sets all the form controls to the state they were in when the form loaded.
We've used it in the previous workshop... so we should probably make a mention of what it's used for. If you have a long quotation, a testimonial, or a section of copy from another source, particularly one that spans four lines or morae, you should mark it up as a blockquote element. It is recommended that content within blockquotes be contained in other elements, such as paragraphs, headings, or lists.
It's appropriate when only one option from the group is allowed (such as Yes or No, or Male or Female).
You can create groups of checkboxes by assigning them the same "name" attribute value, but unlike the radio input, all the on or off states for each checkbox are sent to the server, not just one!
To allow for multiple selections and make the element display as a scrolling list instead, set a size attribute value of higher than 1, and you can also set the attribute multiple="multiple".After we cover the box model in a future lesson, we'll show you how using form elements inside list elements, can help us semantically and help styling.
We've used it in the previous workshop... so we should probably make a mention of what it's used for. If you have a long quotation, a testimonial, or a section of copy from another source, particularly one that spans four lines or morae, you should mark it up as a blockquote element. It is recommended that content within blockquotes be contained in other elements, such as paragraphs, headings, or lists.
With default styling - it will become indented, and on some browsers can even become italicized.