The < table> element is used to add tables to a web page.
A table is drawn out row by row. Each row is created with the < tr> element.
Inside each row there are a number of cells represented by the < td> element (or < th> if it is a header).
You can make cells of a table span more than one row or column using the rowspan and colspan attributes.
For long tables you can split the table into a < thead>, < tbody>, and < tfoot>.
The best known form on the web is probably the search box that sits right in the middle ofGoogle’s homepage.
In addition to enabling users to search, forms also allow users to perform other functions online. You will see forms.
There are several types of form controls that you can use to collect information from visitors to your site , as u see here:
first:
Second: The name of each form control is sent to the server along with the value the user enters or selects.
Third: The server processes the information using a programming language such as PHP, C#, VB.net, or Java. It may also store the information in a database.
Fourth: The server creates a new page to send back to the browser based on the information received.
each gathering different information. The server needs to know which piece of inputted data corresponds with which form element.
Form controls live inside a < form> element. This element should always carry the action attribute and will usually have a method and id attribute too.
action: Every < form> element requires an action attribute. Its value is the URL for the page on the server that will receive the information in the form when it is submitted.
Forms can be sent using one of two methods: get or post.
+With the get method, the values from the form are added to the end of the URL specified in the action attribute. The get method is ideal for:
● short forms (such as search boxes).
● when you are just retrieving data from the web server (not sending information that should be added to or deleted from a database).
< input>:
The < input> element is used to create several different formcontrols. The value of the type attribute determines what kindof input they will be creating.
type=”text” When the type attribute has a value of text, it creates a singleline text input.
< input> type=”password”
When the type attribute has a value of password it createsa text box that acts just like a single-line text input, except the characters are blocked out. They are hidden in this way so that if someone is looking over the user’s shoulder, they cannot see sensitive data such as passwords.
The < textarea> element is used to create a mutli-line text input. Unlike other input elements this is not an empty element. It should therefore have an opening and a closing tag. Any text that appears between the opening < textarea> and closing < /textarea> tags will appear in the text box when the page loads.
If the user does not delete any text between these tags, this message will get sent to the server along with whatever the user has typed. (Some sites use JavaScript to clear this information when the user clicks in the text area.)
< input>: type=”radio”
Radio buttons allow users to pick just one of a number of options.
### Checkbox :
-select- A drop down list box (also known as a select box) allows users to select one option from a drop down list. The -select- element is used to create a drop down list box. It contains two or more -option- elements.
### Image Button :
-button- The -button- element was introduced to allow users more control over how their buttons appear, and to allow other elements to appear inside the button. This means that you can combine text and imagesbetween the opening -button- tag and closing -button- tag.
-fieldset- You can group related form controls together inside the -fieldset- element. This is particularly helpful for longer forms. Most browsers will show the fieldset with a line around the edge to show how they are related. The appearance of these lines can be adjusted using CSS.
-legend- The -legend- element can come directly after the opening -fieldset- tag and contains acaption which helps identify the purpose of that group of formcontrols.
You have probably seen forms on the web that give users messages if the form control has not been filled in correctly; this is known as form validation. Traditionally, form validation has been performed using JavaScript (which is beyond the scope of this book). But HTML5 is introducing validation and leaving the work to the browser.
-input- Many forms need to gather information such as dates, email addresses, and URLs. This has traditionally been done usingtext inputs. HTML5 introduces new form controls to standardize the way that some information is gathered. Older browsers that do not recognize these inputs will just treat them as a single line text box. type=-date- If you are asking the user for a date, you can use an -input- element and give the type attribute a value of date. This will create a date input inbrowsers that support the new HMTL5 input types.
type=”url” A URL input can be used whenyou are asking a user for a web page address
The list-style-type property allows you to control the shape or style of a bullet point (also known as a marker). It can be used on rules that apply to the < ol> , < ul>, and < li> elements.
You can specify an image to act as a bullet point using the list-style-image property.
The value starts with the letters url and is followed by a pair of parentheses. Inside the parentheses, the path to the image is given inside doublequotes.
### Positioning the Marker :
+As with several of the other CSS properties, there is a property that acts as a shorthand for list styles. It is called list-style, and it allows you to express the markers’ style, image and position properties in any order.
width to set the width of the table.
padding to set the space between the border of each table cell and its content
text-transform to convert the content of the table headers to uppercase.
letter-spacing, font-size to add additional styling to the content of the table headers
text-align to align the writing to the left of some table cells and to the right of the others.
background-color to change the background color of the alternating table rows
+If you have empty cells in your table, then you can use the empty-cells property to specify whether or not their borders should be shown.
It is most common to style: ● Text inputs and text areas. ● Submit buttons. ● Labels on forms, to get the form controls to align nicely.
This helpful extension for Firefox and Chrome provides tools to show you the CSS styles that apply to an element when you hover over it, along with the structure of the HTML.
the user or the browser manipulates a page. When the page loads, it is called an event. When the user clicks a button, that click too is an event. Other examples include events like pressing any key, closing a window, resizing a window, etc.
This is the most frequently used event type which occurs when a user clicks the left button of his mouse. You can put your validation, warning etc., against this event type.
onsubmit is an event that occurs when you try to submit a form. You can put your form validation against this event type.
### onmouseover and onmouseout These two event types will help you create nice effects with images or even with text as well. The onmouseover event triggers when you bring your mouse over any element and the onmouseout triggers when you move your mouse out from that element.