HTML and CSS Reference
In-Depth Information
or with a single col and a span attribute, like this:
<table>
<colgroup></colgroup> <colgroup></colgroup> <col-
group><col span="3"></colgroup>
<tr>
This is starting to look like a lot of work—why would anybody bother with this at all?
It's true that at first glance it might appear that you're supplying redundant information,
but this markup does have its uses. There are some side benefits, but the main reason
for the existence of colgroup and col is to allow browsers to render the table even
if all the table row data has yet to arrive. Without the information provided by these two
tags, a browser must first parse the entire table to find the row with the largest number
of cells in it. Next, the browser must calculate the width of that row, and only then will it
know the width of the table and allow it to be rendered. When you let the browser know
up front about the column structure of the table, the browser can render the data as it
arrives.
Form elements
By their very nature web forms are a large topic—even larger so in HTML5 with the
addition of many new elements. The form elements can often require careful coding of
attributes to get groups of elements to work together properly and to have the form suc-
cessfully submit its data to the server. Forms will be covered in depth in Chapter 4 , but
as a taste we will look at a basic example here:
<form action="handle_form.php">
<label for="feedback">Please provide feedback on our
form!</label>
<br />
<textarea id="feedback" rows="5" cols="50" placehold-
er="Enter your comments
here..."></textarea>
<br />
<input type="submit" value="Submit!" />
</form>
When rendered in a web browser, this will look like Figure 2-11 .
Search WWH ::




Custom Search