diff --git a/html.md b/html.md new file mode 100644 index 0000000..d3b8a3f --- /dev/null +++ b/html.md @@ -0,0 +1,735 @@ +--- +title: HTML +date: 2021-07-20 19:16:42 +icon: icon-html +background: bg-yellow-600 +tags: + - null +categories: + - Programming +intro: | + This HTML quick reference cheat sheet lists the common HTML tags and their attributes in an easy-to-read format. +--- + + +Getting started {.cols-3} +------------ + +### hello.html {.col-span-2 .row-span-2} + +```html + + + + + + + HTML5 Boilerplate + + +

Hello world, hello QuickRef.ME!

+ + +``` + +Or try it out in the [jsfiddle](https://jsfiddle.net/Randy8080/1e4wz20b/) + +### Comment + +```html + + + +``` + + +### Paragraph + +```html +

I'm from QuickRef.ME

+

Share quick reference cheat sheet.

+``` +See: [The Paragraph element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p) + + + + +### HTML link + +```html +QuickRef +Email +Call +Msg +``` +--- + +| | | | +|---|----------|----------------------------------------------------| +| | `href` | The URL that the hyperlink points to | +| | `rel` | Relationship of the linked URL | +| | `target` | Link target location:
`_self`, `_blank`, `_top`, `_parent` | +{.left-text} + +See: [The \ Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) + + + +### Image Tag + +```html {.wrap} +Describe image here +``` +--- + +| | | | +|---|----------|-------------------------------------| +| | `src` | Required, Image location _(URL \| Path)_ | +| | `alt` | Describe of the image | +| | `width` | Width of the image | +| | `height` | Height of the image | +| | `loading`| How the browser should load | +{.left-text} + +See: [The Image Embed element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) + + + +### Text Formatting Tags + +```html +Bold Text +This text is important +Italic Text +Emphasis - This text is emphasized +Underline Text +
Preformatted text
+Source code +Deleted text +Marked/highlighted text +Inserted text +Makes text superscripted + Makes text subscripted +Makes text smaller +
Pre-formatted Text
+Ctrl +
Text Block Quote
+``` + + +### Headings +```html +

This is Heading 1

+

This is Heading 2

+

This is Heading 3

+

This is Heading 4

+
This is Heading 5
+
This is Heading 6
+``` +You should only have one h1 on your page + + +### Section Divisions + +| | | +|-----------------|--------------------------------------| +| `
` | Division or Section of Page Content | +| `` | Section of text within other content | +| `

` | Paragraph of Text | +| `
` | Line Break | +| `
` | Basic Horizontal Line | + +These are the tags used to divide your page up into sections + + +### JavaScript in HTML + +```html + +``` + +#### External JavaScript + +```html + + ... + + +``` + +### CSS in HTML + +```html + +``` + +#### External CSS + +```html + +... + + +``` + +### Inline Frame +```html {.wrap} + +``` +#### ↓ Preview + + +See: [The Inline Frame element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) + + +HTML Tables {.cols-3} +-------------- + +### Table Example {.row-span-2} +```html + + + + + + + + + + + + + + + + + +
nameage
Roberta39
Oliver25
+``` + + + +### HTML Table Tags {.row-span-2} + +| Tag | Description | +|-----------------------------------------------------------------------------------|----------------------------------| +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) | Defines a table | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr) | Defines a row in a table | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup) | Defines a group of columns | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col) | Defines a column within a table | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead) | Groups the header content | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody) | Groups the body content | +| [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot) | Groups the footer content | + +### \
](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th) | Defines a header cell in a table | +| [\
](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td) | Defines a cell in a table | +| [\
](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption) | Defines a table caption | +| [\
Attributes + +| Attribute | Description | +|-------------|-----------------------------------------------| +| `colspan` | Number of columns a cell should span | +| `headers` | One or more header cells a cell is related to | +| `rowspan` | Number of rows a cell should span | + +See: [td\#Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attributes) + + + +### \ Attributes + +| Attribute | Description | +|-------------|-----------------------------------------------| +| `colspan` | Number of columns a cell should span | +| `headers` | One or more header cells a cell is related to | +| `rowspan` | Number of rows a cell should span | +| `abbr` | Description of the cell's content | +| [scope](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope) | The header element relates to | + +See: [th\#Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attributes) + + + +HTML Lists {.cols-3} +-------------- + + +### Unordered list +```html +
    +
  • I'm an item
  • +
  • I'm another item
  • +
  • I'm another item
  • +
+``` +See: [The Unordered List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul) + + +### Ordered list + +```html +
    +
  1. I'm the first item
  2. +
  3. I'm the second item
  4. +
  5. I'm the third item
  6. +
+``` +See: [The Ordered List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol) + + +### Definition list + +```html +
+
A Term
+
Definition of a term
+
Another Term
+
Definition of another term
+
+``` +See: [The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl) + + + + +HTML Forms {.cols-3} +----------- + + +### Form tags {.row-span-2} +```html +
+ + +
+ + +
+ +
+ + +
+``` + +#### ↓ Preview +
+ + +
+ + +
+ +
+ + +
+ + +The HTML `
` element is used to collect and send information to an external source. + + +### Form Attribute +| Attribute | Description | +|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| +| `name` | Name of form for scripting | +| `action` | URL of form script | +| `method` | HTTP method, `POST` / `GET` _(default)_ | +| `enctype` | Media type, See [enctype](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) | +| `onsubmit` | Runs when the form was submit | +| `onreset` | Runs when the form was reset | + + + + + +### Label tags +```html + + +``` +--- +```html + + + +``` +`for` in a label references an input's `id` attribute + + + + + +### Input tags +```html + + +``` +#### ↓ Preview + + + +
+ +See: [HTML input Tags](/html#html-input-tags) + + +### Textarea tags +```html {.wrap} + +``` +#### ↓ Preview +
+ +
+ +Textarea is a multiple-line text input control + + + +### Radio Buttons +```html + + + + +``` +#### ↓ Preview +
+ + + + +
+ +Radio buttons are used to let the user select exactly one + + + +### Checkboxes +```html + + + + +``` +#### ↓ Preview +
+ + + + +
+ +Checkboxes allows the user to select one or more + + + +### Select tags +```html + + +``` + +#### ↓ Preview +
+ + +
+ +A select box is a dropdown list of options + + + +### Fieldset tags +```html +
+ Choose your favorite monster + +
+ +
+
+``` +#### ↓ Preview +
+
+ Choose your favorite monster + +
+ +
+
+
+ + + + +### Datalist tags +```html + + + + +``` + +#### ↓ Preview +
+ + + + +
+ + + + +### Submit and Reset Buttons +```html +
+ + + + +
+``` +#### ↓ Preview +
+ + + + +
+ +`Submit` the data to server; `Reset` to default values + + + + + +HTML input Tags {.cols-2} +----------- + + +### Input Attributes {.row-span-2} +The input tag is an empty element, identifying the particular type of field information to obtain from a user. +```html {.wrap} + +``` + +---- + +| - | | | +|---|-------------------------|-------------------------------------------------| +| | `type="…"` | The type of data that is being input | +| | `value="…"` | Default value | +| | `name="…"` | Used to describe this data in the HTTP request | +| | `id="…"` | Unique identifier that other HTML elements | +| | `readonly` | Stops the user from modifying | +| | `disabled` | Stops any interaction | +| | `checked` | The radio or checkbox select or not | +| | `required` | Being compulsory, See [required](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required#example) | +| | `placeholder="…"` | Adds a temporary, See [::placeholder](https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder#examples) | +| | `autocomplete="off"` | Disable auto completion | +| | `autocapitalize="none"` | Disable auto capitalization | +| | `inputmode="…"` | Display a specific keyboard, See [inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | +| | `list="…"` | The id of an associated [datalist](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) | +| | `maxlength="…"` | Maximum number of characters | +| | `minlength="…"` | Minimum number of characters | +| | `min="…"` | Minimum numerical value on range & number | +| | `max="…"` | Maximum numerical value on range & number | +| | `step="…"` | How the number will increment in range & number | +| | `pattern="…"` | Specifies a [Regular expression](/regex), See [pattern](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern) | +| | `autofocus` | Be focused | +| | `spellcheck` | Perform spell checking | +| | `multiple` | Whether to allow [multiple](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple) values | +| | `accept=""` | Expected file type in [file](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) upload controls | +{.left-text} + +Also see: [Attributes for the \ element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) + + +### Input types + +| | | +|-------------------------|--------------------------------------------------------------| +| `type="date"` | | +| `type="time"` | | +| `type="month"` | | +| `type="datetime-local"` | | +| `type="week"` | | + +| `type="checkbox"` | | +| `type="radio"` | | +| `type="color"` | | +| `type="file"` | | +| `type="hidden"` | | + +| `type="number"` | | +| `type="range"` | | + +| `type="text"` | | +| `type="search"` | | +| `type="password"` | | +| `type="email"` | | +| `type="tel"` | | +| `type="url"` | | + +| `type="image"` | | +| `type="reset"` | | +| `type="button"` | Button | +| `type="submit"` | | + + +### Input CSS selectors + +| | | +|------------------|------------------------------------------------| +| `input:focus` | When its keyboard focused | +See: [Input pseudo classes](/css#input-pseudo-classes) + + +HTML meta Tags {.cols-2} +----------- + +### Meta tags {.row-span-3} + +The meta tag describes meta data within an HTML document. It explains additional material about the HTML. + + +```html + +``` + +```html + +··· + + +``` +--- + +```html + + + + +``` +--- + +```html + + + + +``` +--- + +```html + + + +``` +--- + +```html + + +``` +--- + +```html + + + +``` + + + + +### Open Graph +```html + + + + + + + +``` +Used by Facebook, Instagram, Pinterest, LinkedIn, etc. + + +### Twitter Cards +```html + + + + + + +``` +See: [Twitter Card Documentation](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary) + + + +### Geotagging +```html + + + + +``` +See: [Geotagging](https://en.wikipedia.org/wiki/Geotagging#HTML_pages) + + + +Also see +-------- + +- [HTML 4.01 Specification](https://www.w3.org/TR/REC-html40/cover.html#minitoc) _(w3.org)_