-
-
Save heiswayi/acb5b2922d937b6881cc to your computer and use it in GitHub Desktop.
Revisions
-
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 38 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,8 +44,9 @@ All rules and guidelines in this document apply to HTML files. 1. [Structures, Styles and Scripts](#1-structures-styles-and-scripts) 2. [Valid HTML](#2-valid-html) 3. [Semantic HTML](#3-semantic-html) 4. [Form Field Labels](#4-form-field-labels) 5. [Form Field Names](#5-form-field-names) 6. [Entity References](#6-entity-references) <!-- ---------------------------------------------------------------------- --> @@ -460,7 +461,7 @@ This section addresses how to utilize elements and attributes. 3. [**Attribute values**](#3-attribute-values) MUST be wrapped in double quotation marks * e.g. `<a href="" title="">Link</a>` 4. [**Attribute booleans**](#4-attribute-booleans) SHOULD NOT include a value * e.g. `<input type="text" name="" autofocus>` 5. [**Type and language attribute**](#5-type-and-language-attribute) MUST be omitted on `script` tags * e.g. `<script src=""></script>` 6. [**Type attribute**](#6-type-attribute) MUST be omitted on `link` and `style` tags @@ -578,7 +579,7 @@ Attribute booleans SHOULD NOT include a value. #### ✔ Correct <pre lang=html> <input type="text" name="first_name" autofocus> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) @@ -659,9 +660,11 @@ Protocol SHOULD be omitted. * i.e. yes `<ul><li></li></ul>`, no `<ul><p></p></ul>` 3. [**Semantic HTML**](#3-semantic-html) MUST be written * i.e. yes `<a href="">View Options</a>`, no `<div class="click">View Options</div>` 4. [**Form field labels**](#4-form-field-labels) MUST be used * e.g. `<label for=""></label><input name="" type="text">` 5. [**Form field names**](#5-form-field-names) MUST use underscores to separate words * e.g. `<input type="text" name="first_name">` 6. [**Entity references**](#6-entity-references) MUST NOT be used * e.g. yes `—`, no `—` ▲ [Table of Contents](#table-of-contents) @@ -676,7 +679,7 @@ Structures, styles and scripts MUST be separated from each other. <pre lang=html> <div class="internships-module"> ... </div> </pre> @@ -686,7 +689,7 @@ Structures, styles and scripts MUST be separated from each other. <pre lang=html> <div class="module internships" data-track="pageview event"> ... </div> </pre> @@ -778,9 +781,9 @@ nulla.</p> <!-- ------------------------------ --> ### 4. Form Field Labels Form field labels MUST be used. #### ✖ Incorrect @@ -802,7 +805,30 @@ Form fields MUST have a corresponding label. <!-- ------------------------------ --> ### 5. Form Field Names Form field names MUST use underscores to separate words. #### ✖ Incorrect <pre lang=html> <input type="text" name="emailaddress"> <input type="text" name="email-address"> </pre> ↳ Incorrect because `emailaddress` and `email-address` are not using underscores between words. #### ✔ Correct <pre lang=html> <input type="text" name="email_address"> </pre> ▲ [Best Practices](#6-best-practices) <!-- ------------------------------ --> ### 6. Entity References Entity references MUST NOT be used. -
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 15 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -98,6 +98,7 @@ This section showcases the main elements required in a complete HTML file. <head> <title>Welcome</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> </head> <body> <h1>Welcome</h1> @@ -145,7 +146,7 @@ This is a comment <!--This is a comment--> </pre> ↳ Incorrect because there is no space before or after `This is a comment`. #### ✔ Correct @@ -169,7 +170,7 @@ that spans multiple lines --> </pre> ↳ Incorrect because `<!--` and `This is a comment` are on one line. <pre lang=html> <!-- @@ -178,7 +179,7 @@ that spans multiple lines --> </pre> ↳ Incorrect because `This is a comment` and `that spans multiple lines` are indented. #### ✔ Correct @@ -201,15 +202,15 @@ Closing tag comments SHOULD include the class or ID symbol and name. <pre lang=html> <div id="main-wrapper"> ... </div><!-- main-wrapper --> </pre> ↳ Incorrect because `#` prefix is missing. <pre lang=html> <div id="main-wrapper"> ... </div><!-- .main-wrapper --> </pre> @@ -219,7 +220,7 @@ Closing tag comments SHOULD include the class or ID symbol and name. <pre lang=html> <div id="main-wrapper"> ... </div><!-- #main-wrapper --> </pre> @@ -237,7 +238,7 @@ Sensitive information MUST NOT be placed in a comment. <!-- Generated by some_php_function() --> </pre> ↳ Incorrect because comment reveals that markup comes from `some_php_function()`. ▲ [Comments](#3-comments) @@ -250,7 +251,7 @@ This section outline various, general formatting rules related to whitespace and 1. [**Line indentation**](#1-line-indentation) MUST be accomplished using tabs * i.e. `<ul>` `↵` `⇥` `<li>` 2. [**Direct child elements**](#2-direct-child-elements) within `html`, `body`, `style` or `script` element MUST NOT be indented * i.e. `<body>` `↵` `<h1></h1>` `↵` `</body>`, `<head>` `↵` `⇥` `...` `</head>` 3. [**Block, list and table elements**](#3-block-list-and-table-elements) MUST start on a new line and their children MUST be indented * i.e. `<div>` `↵` `⇥` `<h1>`, `<table>` `↵` `⇥` `<th>` 4. [**Trailing whitespace**](#4-trailing-whitespace) MUST NOT be present @@ -275,7 +276,7 @@ Line indentation MUST be accomplished using tabs. </ul> </pre> ↳ Incorrect because `<li>` is indented with spaces instead of tabs. #### ✔ Correct @@ -322,8 +323,7 @@ Direct child elements within `html`, `body`, `style` or `script` element MUST NO </html> </pre> ↳ Incorrect because `<head>`, `<body>` and `<div>` are indented.<br /> ↳ Incorrect because contents within `<style>` and `<script>` are indented. #### ✔ Correct @@ -435,7 +435,7 @@ Elements and attributes MUST be all lowercase. </div> </pre> ↳ Incorrect because `ID`, `mainWrapper`, `DESKTOP` and `<P>` are not lowercase. #### ✔ Correct @@ -545,7 +545,7 @@ Attribute values MUST be wrapped in double quotation marks. <pre lang=html> <form action=processor.php class='application'> ... </form> </pre> @@ -555,7 +555,7 @@ Attribute values MUST be wrapped in double quotation marks. <pre lang=html> <form action="processor.php" class="application"> ... </form> </pre> @@ -666,8 +666,6 @@ Protocol SHOULD be omitted. ▲ [Table of Contents](#table-of-contents) <!-- ------------------------------ --> ### 1. Structures, Styles and Scripts @@ -677,7 +675,7 @@ Structures, styles and scripts MUST be separated from each other. #### ✖ Incorrect <pre lang=html> <div class="internships-module"> </div> </pre> -
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -757,7 +757,7 @@ molestie nulla.</p> ↳ Incorrect because `Lorem ipsum` is to be bold, not strongly spoken by a screen reader. <pre lang=html> <div class="textarea">Write your text here.</div> </pre> ↳ Incorrect because `<div>` is not a natural element for user input. -
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -747,10 +747,11 @@ Semantic HTML MUST be written. ↳ Incorrect because `<a>` is the elementing for clicking, not `<div>`. <pre lang=html> <p><strong>Lorem ipsum:</strong> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> </pre> ↳ Incorrect because `Lorem ipsum` is to be bold, not strongly spoken by a screen reader. @@ -766,10 +767,11 @@ non molestie nulla.</p> <pre lang=html> <a href="#" class="button">Click Here</a> <p><b>Lorem ipsum:</b> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> <textarea name="comment">Write your text here.</textarea> </pre> -
ryansechrest revised this gist
Feb 5, 2014 . No changes.There are no files selected for viewing
-
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -747,7 +747,10 @@ Semantic HTML MUST be written. ↳ Incorrect because `<a>` is the elementing for clicking, not `<div>`. <pre lang=html> <p><strong>Lorem ipsum:</strong> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> </pre> ↳ Incorrect because `Lorem ipsum` is to be bold, not strongly spoken by a screen reader. @@ -756,14 +759,17 @@ Semantic HTML MUST be written. <div class="textrea">Write your text here.</div> </pre> ↳ Incorrect because `<div>` is not a natural element for user input. #### ✔ Correct <pre lang=html> <a href="#" class="button">Click Here</a> <p><b>Lorem ipsum:</b> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> <textarea name="comment">Write your text here.</textarea> </pre> -
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 84 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -674,10 +674,22 @@ Protocol SHOULD be omitted. Structures, styles and scripts MUST be separated from each other. #### ✖ Incorrect <pre lang=html> <div class="news-module"> </div> </pre> ↳ Incorrect because structure, style and functionality are not decoupled. #### ✔ Correct <pre lang=html> <div class="module internships" data-track="pageview event"> </div> </pre> ▲ [Best Practices](#6-best-practices) @@ -688,10 +700,34 @@ Structures, styles and scripts MUST be separated from each other. Valid HTML MUST be written. #### ✖ Incorrect <pre lang=html> <ul> <li>Item one</li> <li>Item two</li> <ul> <li>Sub-item one</li> <li>Sub-item two</li> </ul> </ul> </pre> ↳ Incorrect because `<ul>` cannot be a child of a `<ul>`. #### ✔ Correct <pre lang=html> <ul> <li>Item one</li> <li>Item two</li> <li> <ul> <li>Sub-item one</li> <li>Sub-item two</li> </ul> </li> </ul> </pre> ▲ [Best Practices](#6-best-practices) @@ -702,10 +738,34 @@ Valid HTML MUST be written. Semantic HTML MUST be written. #### ✖ Incorrect <pre lang=html> <div class="button">Click Here</div> </pre> ↳ Incorrect because `<a>` is the elementing for clicking, not `<div>`. <pre lang=html> <p><strong>Lorem ipsum:</strong> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> </pre> ↳ Incorrect because `Lorem ipsum` is to be bold, not strongly spoken by a screen reader. <pre lang=html> <div class="textrea">Write your text here.</div> </pre> ↳ Incorrect because `<div>` is not the natural element for user input. #### ✔ Correct <pre lang=html> <a href="#" class="button">Click Here</a> <p><b>Lorem ipsum:</b> Dolor sit amet, consectetur adipiscing elit. Sed tincidunt urna id dui aliquet facilisis. Maecenas nulla diam, scelerisque et nisl congue, ornare fermentum turpis. Pellentesque eu lorem nulla. Sed interdum sagittis eros non vulputate. Donec sed interdum ante. Phasellus non molestie nulla.</p> <textarea name="comment">Write your text here.</textarea> </pre> ▲ [Best Practices](#6-best-practices) @@ -716,10 +776,20 @@ Semantic HTML MUST be written. Form fields MUST have a corresponding label. #### ✖ Incorrect <pre lang=html> <input type="radio" name="gender" id="male" value="male"> <input type="radio" name="gender" id="female" value="female"> </pre> ↳ Incorrect because `<label>` is missing. #### ✔ Correct <pre lang=html> <input type="radio" name="gender" id="male" value="male"> <label for="male">Male</label> <input type="radio" name="gender" id="female" value="female"> <label for="female">Female</label> </pre> ▲ [Best Practices](#6-best-practices) @@ -730,10 +800,18 @@ Form fields MUST have a corresponding label. Entity references MUST NOT be used. #### ✖ Incorrect <pre> € </pre> ↳ Incorrect because `€` entity reference is used. #### ✔ Correct <pre> € </pre> ▲ [Best Practices](#6-best-practices) -
ryansechrest revised this gist
Feb 5, 2014 . 1 changed file with 41 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -595,7 +595,7 @@ Type and language attribute MUST be omitted on `script` tags. <script src="//script.js" type="text/javascript"></script> </pre> ↳ Incorrect because `type` attribute is included. #### ✔ Correct @@ -653,15 +653,15 @@ Protocol SHOULD be omitted. ## 6. Best Practices 1. [**Structures, styles and scripts**](#1-structures-styles-and-scripts) MUST be separated from each other * e.g. `<a class="button" data-track="pageview">Read More</a>` 2. [**Valid HTML**](#2-valid-html) MUST be written * i.e. yes `<ul><li></li></ul>`, no `<ul><p></p></ul>` 3. [**Semantic HTML**](#3-semantic-html) MUST be written * i.e. yes `<a href="">View Options</a>`, no `<div class="click">View Options</div>` 4. [**Form fields**](#4-form-fields) MUST have a corresponding `label` * e.g. `<label for=""></label><input id="" type="text">` 5. [**Entity references**](#5-entity-references) MUST NOT be used * e.g. yes `—`, no `—` ▲ [Table of Contents](#table-of-contents) @@ -672,39 +672,69 @@ Protocol SHOULD be omitted. ### 1. Structures, Styles and Scripts Structures, styles and scripts MUST be separated from each other. #### Example <pre lang=html> </pre> ▲ [Best Practices](#6-best-practices) <!-- ------------------------------ --> ### 2. Valid HTML Valid HTML MUST be written. #### Example <pre lang=html> </pre> ▲ [Best Practices](#6-best-practices) <!-- ------------------------------ --> ### 3. Semantic HTML Semantic HTML MUST be written. #### Example <pre lang=html> </pre> ▲ [Best Practices](#6-best-practices) <!-- ------------------------------ --> ### 4. Form Fields Form fields MUST have a corresponding label. #### Example <pre lang=html> </pre> ▲ [Best Practices](#6-best-practices) <!-- ------------------------------ --> ### 5. Entity References Entity references MUST NOT be used. #### Example <pre lang=html> </pre> ▲ [Best Practices](#6-best-practices) -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -570,7 +570,7 @@ Attribute booleans SHOULD NOT include a value. #### ~ Acceptable <pre lang=html> <input type="text" name="first_name" autofocus="autofocus"> </pre> ↳ Acceptable, but `autofocus` value is not required for `autofocus` attribute. @@ -600,7 +600,7 @@ Type and language attribute MUST be omitted on `script` tags. #### ✔ Correct <pre lang=html> <script src="//script.js"></script> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 13 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,7 +116,7 @@ This section describes how comments should be formatted and used. 1. [**Single-line comments**](#1-single-line-comments) MUST be on one line and text inside MUST be surrounded by spaces * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line and text MUST NOT be indented * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD include the class or ID symbol and name * e.g. `</div><!-- #main-wrapper -->` @@ -129,7 +129,7 @@ This section describes how comments should be formatted and used. ### 1. Single-line Comments Single-line comments MUST be on one line and text inside MUST be surrounded by spaces. #### ✖ Incorrect @@ -145,7 +145,7 @@ This is a comment <!--This is a comment--> </pre> ↳ Incorrect because there is no space between `<!--` and `This`, and `comment` and `-->`. #### ✔ Correct @@ -159,7 +159,7 @@ This is a comment ### 2. Multi-line Comments Multi-line comments MUST start and end on their own line and text MUST NOT be indented. #### ✖ Incorrect @@ -171,6 +171,15 @@ that spans multiple lines ↳ Incorrect because `<!--` and `This is a comment` is on one line. <pre lang=html> <!-- This is a comment that spans multiple lines --> </pre> ↳ Incorrect because text is indented. #### ✔ Correct <pre lang=html> -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -118,7 +118,7 @@ This section describes how comments should be formatted and used. * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD include the class or ID symbol and name * e.g. `</div><!-- #main-wrapper -->` 4. [**Sensitive information**](#4-sensitive-information) MUST NOT be placed in a comment * e.g. `<!-- Sends email to [email protected] -->` @@ -186,7 +186,7 @@ that spans multiple lines ### 3. Closing Tag Comments Closing tag comments SHOULD include the class or ID symbol and name. #### ✖ Incorrect -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -118,7 +118,7 @@ This section describes how comments should be formatted and used. * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD be prefixed with a `#` or `.` followed by the name * e.g. `</div><!-- #main-wrapper -->` 4. [**Sensitive information**](#4-sensitive-information) MUST NOT be placed in a comment * e.g. `<!-- Sends email to [email protected] -->` @@ -186,7 +186,7 @@ that spans multiple lines ### 3. Closing Tag Comments Closing tag comments SHOULD be prefixed with either a `#` or `.` followed by the name. #### ✖ Incorrect -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -118,7 +118,7 @@ This section describes how comments should be formatted and used. * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD be prefixed with a `#` or `.`, and followed by the name * e.g. `</div><!-- #main-wrapper -->` 4. [**Sensitive information**](#4-sensitive-information) MUST NOT be placed in a comment * e.g. `<!-- Sends email to [email protected] -->` @@ -186,7 +186,7 @@ that spans multiple lines ### 3. Closing Tag Comments Closing tag comments SHOULD be prefixed with either a `#` or `.`, and followed by the name. #### ✖ Incorrect -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -114,7 +114,7 @@ This section showcases the main elements required in a complete HTML file. This section describes how comments should be formatted and used. 1. [**Single-line comments**](#1-single-line-comments) MUST be on one line and text inside MUST be surrounded by spaces * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` @@ -129,7 +129,7 @@ This section describes how comments should be formatted and used. ### 1. Single-line Comments Single-line comments MUST be on one line and text inside MUST be surrounded by spaces #### ✖ Incorrect -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,7 +73,7 @@ This section describes the format and naming convention of HTML files. ## 2. Document This section showcases the main elements required in a complete HTML file. 1. **Doctype** MUST be specified and SHOULD be HTML5 * e.g. `<!DOCTYPE html>` -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,9 +63,9 @@ This section describes the format and naming convention of HTML files. #### Filename 1. **Letters** MUST be all lowercase * e.g. `sidebar.html`, `sidebar.php` 2. **Words** MUST be separated with a hyphen * e.g. `social-media-widget.html`, `social-media-widget.php` ▲ [Table of Contents](#table-of-contents) -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ All rules and guidelines in this document apply to HTML files. 2. Language 3. Character Encoding 4. Viewport 5. Head and Body 3. [**Comments**](#3-comments) 1. [Single-line Comments](#1-single-line-comments) 2. [Multi-line Comments](#2-multi-line-comments) -
ryansechrest revised this gist
Feb 4, 2014 . 1 changed file with 198 additions and 30 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,16 +32,14 @@ All rules and guidelines in this document apply to HTML files. 3. [Block, List and Table Elements](#3-block-list-and-table-elements) 4. [Trailing Whitespace](#4-trailing-whitespace) 5. [Elements and Attributes](#5-elements-and-attributes) 5. [**Elements and Attributes**](#5-elements-and-attributes) 1. [Self-closing Elements](#1-self-closing-elements) 2. [Optional Open/Close Tags](#2-optional-openclose-tags) 3. [Attribute Values](#3-attribute-values) 4. [Attribute Booleans](#4-attribute-booleans) 5. [Type and Language Attribute](#5-type-and-language-attribute) 6. [Type Attribute](#6-type-attribute) 7. [Protocol](#7-protocol) 6. [**Best Practices**](#6-best-practices) 1. [Structures, Styles and Scripts](#1-structures-styles-and-scripts) 2. [Valid HTML](#2-valid-html) @@ -250,8 +248,6 @@ This section outline various, general formatting rules related to whitespace and * i.e. no `<p></p>` `·` `·` `↵` 5. [**Elements and attributes**](#5-elements-and-attributes) MUST be all lowercase * e.g. `<a href="" title="">`, `<link rel="stylesheet" href="">` ▲ [Table of Contents](#table-of-contents) @@ -357,6 +353,41 @@ Direct child elements within `html`, `body`, `style` or `script` element MUST NO Block, list and table elements MUST start on a new line and their children MUST be indented. #### ✖ Incorrect <pre lang=html> <div><p>This is a paragraph.</p></div> <ul><li>Item one</li><li>Item two</li></ul> <table><tr><th>Header</th></tr><tr><td>Content</td></tr></table> </pre> ↳ Incorrect because `<div>`, `<ul>`, `<table>` and`<tr>` are not on their own line.<br /> ↳ Incorrect because `<p>`, `<li>`, `<tr>` and `<td>`are not indented. #### ✔ Correct <pre lang=html> <div> <p>This is a paragraph.</p> </div> <ul> <li>Item one</li> <li>Item two</li> </ul> <table> <tr> <th>Header</th> </tr> <tr> <td>Content</td> </tr> </table> </pre> ▲ [Formatting](#4-formatting) <!-- ------------------------------ --> @@ -365,6 +396,20 @@ Block, list and table elements MUST start on a new line and their children MUST Trailing whitespace MUST NOT be present. #### ✖ Incorrect <pre lang=html> <p>This is a paragraph.</p> </pre> ↳ Incorrect because there are spaces after `</p>`. #### ✔ Correct <pre lang=html> <p>This is a paragraph.</p> </pre> ▲ [Formatting](#4-formatting) <!-- ------------------------------ --> @@ -373,13 +418,23 @@ Trailing whitespace MUST NOT be present. Elements and attributes MUST be all lowercase. #### ✖ Incorrect <pre lang=html> <div ID="mainWrapper" class="DESKTOP"> <P>This is a paragraph</P> </div> </pre> ↳ Incorrect because `ID`, `mainWrapper`, `DESKTOP`, and `<P>` are not lowercase. #### ✔ Correct <pre lang=html> <div id="main-wrapper" class="desktop"> <p>This is a paragraph</p> </div> </pre> ▲ [Formatting](#4-formatting) @@ -393,17 +448,15 @@ This section addresses how to utilize elements and attributes. * e.g. `<br>`, `<link rel="stylesheet" href="">` 2. [**Optional open/close tags**](#2-optional-openclose-tags) MUST be included * e.g. `<ul><li></li></ul>` 3. [**Attribute values**](#3-attribute-values) MUST be wrapped in double quotation marks * e.g. `<a href="" title="">Link</a>` 4. [**Attribute booleans**](#4-attribute-booleans) SHOULD NOT include a value * e.g. `<input autofocus type="text">` 5. [**Type and language attribute**](#5-type-and-language-attribute) MUST be omitted on `script` tags * e.g. `<script src=""></script>` 6. [**Type attribute**](#6-type-attribute) MUST be omitted on `link` and `style` tags * e.g. `<style src=""></script>` 7. [**Protocol**](#7-protocol) SHOULD be omitted * e.g. `<link href="//style.css" rel="stylesheet">` ▲ [Table of Contents](#table-of-contents) @@ -414,6 +467,24 @@ This section addresses how to utilize elements and attributes. Self-closing elements MUST NOT be closed. #### ✖ Incorrect <pre lang=html> <link href="theme.css" rel="stylesheet" /> <br /> </pre> ↳ Incorrect because `<link>` and `<br>` have a `/` at the end. #### ✔ Correct <pre lang=html> <link href="theme.css" rel="stylesheet"> <br> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> @@ -422,54 +493,151 @@ Self-closing elements MUST NOT be closed. Optional open/close tags MUST be included. #### ✖ Incorrect <pre lang=html> <!DOCTYPE html> <html lang="en"> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document. </div> </html> </pre> ↳ Incorrect because `<head></head>`, `<body></body>` and `</p>` are missing. #### ✔ Correct <pre lang=html> <!DOCTYPE html> <html lang="en"> <head> <title>Welcome</title> </head> <body> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document.</p> </div> </body> </html> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> ### 3. Attribute Values Attribute values MUST be wrapped in double quotation marks. #### ✖ Incorrect <pre lang=html> <form action=processor.php class='application'> </form> </pre> ↳ Incorrect because `processor.php` and `application` are not wrapped in double quotes. #### ✔ Correct <pre lang=html> <form action="processor.php" class="application"> </form> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> ### 4. Attribute Booleans Attribute booleans SHOULD NOT include a value. #### ~ Acceptable <pre lang=html> <input type="text" name="first-name" autofocus="autofocus"> </pre> ↳ Acceptable, but `autofocus` value is not required for `autofocus` attribute. #### ✔ Correct <pre lang=html> <input type="text" name="first-name" autofocus> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> ### 5. Type and Language Attribute Type and language attribute MUST be omitted on `script` tags. #### ✖ Incorrect <pre lang=html> <script src="//script.js" type="text/javascript"></script> </pre> ↳ Incorrect because `type` is included. #### ✔ Correct <pre lang=html> <script src="//script.js"</script> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> ### 6. Type Attribute Type attribute MUST be omitted on `link` and `style` tags. #### ✖ Incorrect <pre lang=html> <link rel="stylesheet" href="//style.css" type="text/css"> </pre> ↳ Incorrect because `type` attribute is included. #### ✔ Correct <pre lang=html> <link rel="stylesheet" href="//style.css"> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ------------------------------ --> ### 7. Protocol Protocol SHOULD be omitted. #### ~ Acceptable <pre lang=html> <link rel="stylesheet" href="http://domain.com/style.css"> </pre> ↳ Acceptable, but `http://domain.com` could be replaced with `//`. #### ✔ Correct <pre lang=html> <link rel="stylesheet" href="//style.css"> </pre> ▲ [Elements and Attributes](#5-elements-and-attributes) <!-- ---------------------------------------------------------------------- --> -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -341,12 +341,10 @@ Direct child elements within `html`, `body`, `style` or `script` element MUST NO </script> </head> <body> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document.</p> </div> </body> </html> </pre> -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -102,11 +102,8 @@ This section showcases the main elements required in a full HTML file. <meta charset="utf-8"> </head> <body> <h1>Welcome</h1> <p>This is a skeleton document.</p> </body> </html> </pre> @@ -312,12 +309,10 @@ Direct child elements within `html`, `body`, `style` or `script` element MUST NO </script> </head> <body> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document.</p> </div> </body> </html> </pre> -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -245,7 +245,7 @@ This section outline various, general formatting rules related to whitespace and 1. [**Line indentation**](#1-line-indentation) MUST be accomplished using tabs * i.e. `<ul>` `↵` `⇥` `<li>` 2. [**Direct child elements**](#2-direct-child-elements) within `html`, `body`, `style` or `script` element MUST NOT be indented * i.e. `<head>` `↵` `⇥` `...` `</head>`, `<body><h1></h1></body>` 3. [**Block, list and table elements**](#3-block-list-and-table-elements) MUST start on a new line and their children MUST be indented * i.e. `<div>` `↵` `⇥` `<h1>`, `<table>` `↵` `⇥` `<th>` @@ -290,7 +290,7 @@ Line indentation MUST be accomplished using tabs. ### 2. Direct Child Elements Direct child elements within `html`, `body`, `style` or `script` element MUST NOT be indented. #### ✖ Incorrect -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -322,8 +322,8 @@ Direct child elements within `html`, `body`, `script` or `style` element MUST NO </html> </pre> ↳ Incorrect because `<head>` and `<body>` within `<html>` are indented.<br /> ↳ Incorrect because `<div>` within `<body>` is indented.<br /> ↳ Incorrect because contents within `<style>` and `<script>` are indented. #### ✔ Correct -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -322,7 +322,9 @@ Direct child elements within `html`, `body`, `script` or `style` element MUST NO </html> </pre> ↳ Incorrect because `<head>` and `<body>` within `<html>` are indented. ↳ Incorrect because `<div>` within `<body>` is indented. ↳ Incorrect because contents within `<style>` and `<script>` are indented. #### ✔ Correct -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 86 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -144,13 +144,13 @@ This is a comment --> </pre> ↳ Incorrect because `<!--`, `This is a comment` and `-->` should be one line. <pre lang=html> <!--This is a comment--> </pre> ↳ Incorrect because there is not space between `<!--` and `This`, and `comment` and `-->`. #### ✔ Correct @@ -174,7 +174,7 @@ that spans multiple lines --> </pre> ↳ Incorrect because `<!--` and `This is a comment` is on one line. #### ✔ Correct @@ -233,7 +233,7 @@ Sensitive information MUST NOT be placed in a comment. <!-- Generated by some_php_function() --> </pre> ↳ Incorrect because comment reveals that markup came from `some_php_function()`. ▲ [Comments](#3-comments) @@ -264,6 +264,26 @@ This section outline various, general formatting rules related to whitespace and Line indentation MUST be accomplished using tabs. #### ✖ Incorrect <pre lang=html> <ul> <li>Item number one</li> <li>Item number two</li> </ul> </pre> ↳ Incorrect because `<li>` was indented with spaces instead of tabs. #### ✔ Correct <pre lang=html> <ul> <li>Item number one</li> <li>Item number two</li> </ul> </pre> ▲ [Formatting](#4-formatting) <!-- ------------------------------ --> @@ -272,6 +292,68 @@ Line indentation MUST be accomplished using tabs. Direct child elements within `html`, `body`, `script` or `style` element MUST NOT be indented. #### ✖ Incorrect <pre lang=html> <!DOCTYPE html> <html lang="en"> <head> <title>Welcome</title> <meta charset="utf-8"> <style> #main-wrapper { width: 960px; } </style> <script> function show_alert() { } </script> </head> <body> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document.</p> </div> </body> </html> </pre> ↳ Incorrect because `<head>` and `<body>`, `<div>`, and the contents within `<style>` and `<script>` are indented. #### ✔ Correct <pre lang=html> <!DOCTYPE html> <html lang="en"> <head> <title>Welcome</title> <meta charset="utf-8"> <style> #main-wrapper { width: 960px; } </style> <script> function show_alert() { } </script> </head> <body> <div id="main-wrapper"> <h1>Welcome</h1> <p>This is a skeleton document.</p> </div> </body> </html> </pre> ▲ [Formatting](#4-formatting) <!-- ------------------------------ --> -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -122,7 +122,7 @@ This section describes how comments should be formatted and used. 1. [**Single-line comments**](#1-single-line-comments) MUST be on one line and the comment surrounded by spaces * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `-->` 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD be prefixed with a `#` or `.`, followed by the name * e.g. `</div><!-- #main-wrapper -->` 4. [**Sensitive information**](#4-sensitive-information) MUST NOT be placed in a comment -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -123,7 +123,7 @@ This section describes how comments should be formatted and used. * e.g. `<!-- This is a comment -->` 2. [**Multi-line comments**](#2-multi-line-comments) MUST start and end on their own line * i.e. `<!--` `↵` `Line number one` `↵` `Line number two` `↵` `--> 3. [**Closing tag comments**](#3-closing-tag-comments) SHOULD be prefixed with a `#` or `.`, followed by the name * e.g. `</div><!-- #main-wrapper -->` 4. [**Sensitive information**](#4-sensitive-information) MUST NOT be placed in a comment * e.g. `<!-- Sends email to [email protected] -->` @@ -191,7 +191,7 @@ that spans multiple lines ### 3. Closing Tag Comments Closing tag comments SHOULD be prefixed with either a `#` or `.`, followed by the name. #### ✖ Incorrect -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -233,7 +233,7 @@ Sensitive information MUST NOT be placed in a comment. <!-- Generated by some_php_function() --> </pre> ↳ Incorrect because comment reveals server-side process. ▲ [Comments](#3-comments) -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -233,7 +233,7 @@ Sensitive information MUST NOT be placed in a comment. <!-- Generated by some_php_function() --> </pre> ↳ Incorrect because comment reveals server-side processes. ▲ [Comments](#3-comments) -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -201,15 +201,15 @@ Closing tag comments SHOULD be prefixed with either a `#` or `.` followed by the </div><!-- main-wrapper --> </pre> ↳ Incorrect because `#` prefix is missing. <pre lang=html> <div id="main-wrapper"> ... </div><!-- .main-wrapper --> </pre> ↳ Incorrect because `main-wrapper` is prefixed with `.` instead of `#`. #### ✔ Correct @@ -233,7 +233,7 @@ Sensitive information MUST NOT be placed in a comment. <!-- Generated by some_php_function() --> </pre> ↳ Incorrect because comments reveals server-side processes. ▲ [Comments](#3-comments) -
ryansechrest revised this gist
Jan 30, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -201,15 +201,15 @@ Closing tag comments SHOULD be prefixed with either a `#` or `.` followed by the </div><!-- main-wrapper --> </pre> ↳ Incorrect because the `#` prefix is missing. <pre lang=html> <div id="main-wrapper"> ... </div><!-- .main-wrapper --> </pre> ↳ Incorrect because `main-wrapper` is prefixed with a `.` when it should be `#`. #### ✔ Correct
NewerOlder