This is a draft cheat sheet. It is a work in progress and is not finished yet.
Basic
HTML Document <!DOCTYPE html> <html lang="en-US"> <body> </body> </html>
|
Headings <h1>This is heading 1</h1>
Headers: h1-h6
|
Paragraph <p>This is a paragraph.</p>
|
Horizontal Line (thematic change)
|
Button <button>Click me</button>
|
Line Break
|
Preformatted text <pre>Preformatted text</pre>
|
Short Quotation
|
Quotation <blockquote cite="URL"> Text of quote </blockquote>
|
Abbreviation/acronym <abbr title="World Health Organization">WHO</abbr>
|
Contact Information <address>contact information</address>
|
Work Title <cite>The Scream</cite>
|
Bi-Directional Override <bdo dir="rtl">This text will be written from right to left</bdo>
|
Comment <!-- This is a comment -->
|
** ``
|
** ``
|
Styles
Inline Styles <tagname style="property:value;">
|
Internal CSS <style> selector {property:value;} </style>
|
External CSS <link rel="stylesheet" href="file.css">
|
Links
Link <a href="url">Link</a>
|
Target Attribute _blank - new window/tab _self - same tab (default) _parent - parent frame _top - full body of the window framename - named frame
|
Image as Link <a href="url"><img src="img.gif"></a>
|
Link Title title="Go to W3Schools HTML section"
|
Bookmark Link <a href="#C4">Jump to Chapter 4</a> <h2 id="C4">Chapter 4</h2>
|
Image
Image <img src="logo.jpg" alt="Logo" width="104" height="142">
|
Image Map <img src="workplace.jpg" alt="Workplace" usemap="#workmap"> <map name="workmap"> <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm"> <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm"> <area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm"> </map>
|
<picture> Element <picture> <source media="(min-width: 650px)" srcset="img_pink_flowers.jpg"> <source media="(min-width: 465px)" srcset="img_white_flower.jpg"> <img src="img_orange_flowers.jpg" alt="Flowers" style="width:auto;"> </picture>
The browser will use the first <source> element with matching attribute values, and ignore any following <source> elements.
|
|
|
Text Formatting
|
bold text |
|
emphasized text |
|
italic text |
|
smaller text |
|
important text |
|
subscripted text |
|
superscripted text |
|
inserted text |
|
deleted text |
|
marked/highlighted text |
Tables
Table <table> <tr> <th>Table Heading Cell</th> <th>Table Heading Cell</th> </tr> <tr> <td>Table Cell</td> <td>Table Cell</td> </tr> </table>
|
Cells that Span Many Columns <td colspan="2">Two columns cell</td>
|
Cells that Span Many Rows <td rowspan="2">Two rows cell</td>
|
Table Caption <caption>Table Header</caption>
- must be first element of <table>
tag
|
Grouping elements <colgroup>
- Specifies a group of one or more columns in a table for formatting <thead>
- header content in a table <tbody>
- Groups the body content in a table <tfoot>
- Groups the footer content in a table`
|
Lists
Unordered/Bulled <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul>
|
Ordered <ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol>
Attributes: type="1"
- numbers (default) type="A"
- uppercase letters type="a"
- lowercase letters type="I"
- uppercase roman numbers type="i"
- lowercase roman numbers Start number: start="begin_number"
|
Description List <dl> <dt>Coffee</dt> <dd>- black hot drink</dd> <dt>Milk</dt> <dd>- white cold drink</dd> </dl>
|
Nested List <ul>/<ol> inside <li>
|
|
|
|