Lists#
Website menus are usually a <ul> of links inside <nav>. CSS then turns the list into a horizontal menu bar.
Tables#
Use tables for tabular data - marks, prices, timetables. (Never use tables for page layout; that's CSS's job.)
| Element | Meaning |
|---|---|
<table> |
the whole table |
<caption> |
the table's title |
<thead>, <tbody>, <tfoot> |
header rows, body rows, footer rows |
<tr> |
a table row |
<th> |
a header cell |
<td> |
a data cell |
colspan="2" / rowspan="2" |
a cell that spans 2 columns / 2 rows |
Table में हर <tr> एक लाइन (row) है, और उस row के अंदर हर <td> एक खाना (cell) है। Heading वाले खानों के लिए <th> लिखते हैं। अगर कोई खाना दो columns जितना चौड़ा चाहिए तो colspan="2" लिखें।
Forms#
Forms collect information from visitors - admission enquiries, login, search, feedback.
Press Send enquiry with an empty name, or a wrong email - the browser stops you. That is HTML5 validation, with no JavaScript at all.
Common input types#
type= |
Shows |
|---|---|
text, password |
one-line text; password hides characters |
email, tel, url |
text with format checking (and the right phone keyboard) |
number |
number with up/down arrows; use min, max, step |
date, time |
date / time picker |
checkbox |
tick on/off (many can be ticked) |
radio |
choose one of a group (same name) |
file |
upload a file |
range, color |
slider, colour picker |
Useful attributes#
required- must be filledplaceholder- grey hint text (not a replacement for a label!)min,max,minlength,maxlength,pattern- validation rulesname- the key used when the form data is sent to the serveraction="/enquiry"andmethod="post"on<form>- where and how the data is sent
HTML validation helps the user, but it is not security. Anyone can bypass it. A real server (Python Flask, Node.js...) must check the data again before saving it.
Summary#
<ul>,<ol>and<dl>for lists;<li>for each item.- Tables use
<table>,<tr>,<th>,<td>, with<thead>/<tbody>andcolspan/rowspan. - Every form control needs a
<label>; radio buttons in one group share aname. - Built-in validation:
required,type="email",pattern,min/max.