- Global
- Identation
- Commits
- English
- Task number
- Status
- Message convention
- HTML
- Syntax
- Comments
- Character Encoding
- Attribute Order
- Performance
- Base Code
- CSS
- Syntax
- Comments
- Declaration Order
- Name
- Performance
- Media Queries
- Javascript
- Syntax
- Comments
- Variables
- Performance
Use double quotes
<!-- Good -->
<div class="section">
<!-- Bad-->
<div class='section'>Do not use the character / to elements that do not have closing tag.
<!-- Good -->
<img src="..." alt="...">
<!-- Bad-->
<img src="..." alt="..." />The most common use of comments in HTML, is to signal the closing of a tag. The character / would be the same as writing end. The preference in the tag identification is by its class.
<!-- Good -->
<div class="container" id="section">
</div><!-- /container -->
<!-- Bad -->
<div class="container" id="section">
</div><!-- section -->The ideal is that the comments are not in the production environment, just being a guideline for development. We can also have a comment block to facilitate understanding.
<!-- Good -->
<!--
Comment block ...
-->
<div></div>
<!-- Bad -->
<!--
###############################################################
# Comment block ...
###############################################################
-->
<div></div>Always use utf-8
<head>
<meta charset="utf-8">
</head>The attributes order facilitates reading and organization
- class
- id, name
- data-*
- src, for, type, href
- title, alt
- aria-*, role, itemprop
<div class="..." id="..." itemprop="..."></div>
<a class="..." href="...">...</a>
<img class="..." src="..." alt="...">If you need to have external script inside the tag head, should always be last.
<!-- Good -->
<link rel="stylesheet" href="style.css" />
<script src="scripts.min.js"></script>
<!-- Bad -->
<script src="scripts.min.js"></script>
</head>Ideally, the scripts are in the end of the file, before the closing tag body.
<!-- Good -->
<script src="scripts.min.js"></script>
</body>
<!-- Bad -->
<script src="scripts.min.js"></script>
</head>Remove spaces and comments, no doubt bring better performance and are dispensable in the production environment.
<!-- Good -->
<html><head>...</head><body><div class="main">...</div></body></html>
<!-- Bad -->
<html>
<head>
...
</head>
<body>
<div class="main">
...
</div><!-- /main -->
</body>
</html>Basic HTML use for projects
<!DOCTYPE html>
<html class="no-js" lang="pt-BR" xml:lang="pt-BR">
<head>
<meta charset="utf-8">
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script type="text/javascript">
// to identify if javascript is active
var tagHtml = document.getElementsByTagName("html")[0];
tagHtml.className = tagHtml.className.replace('no-js', 'js');
</script>
</head>
<body>
</body>
</html>Meta tags that use more.
<meta name="format-detection" content="telephone=no">
<meta name="referrer" content="origin">
<meta name="description" content="Description">
<!-- facebook -->
<meta property="og:site_name" content="Site name">
<meta property="og:title" content="Title">
<meta property="og:type" content="website">
<meta property="og:url" content="Url">
<meta property="og:description" content="Description">
<meta property="og:image" content="Image">
<meta property="fb:admins" content="">
<meta property="fb:app_id" content="">
<link rel="image_src" href="Image">
<!-- component schema.org -->
<meta itemprop="name" content="Site name">
<meta itemprop="description" content="Description">
<meta itemprop="image" content="Image">
<meta itemprop="url" content="Url">
<meta name="geo.country" content="">
<meta name="geo.region" content="">
<meta name="geo.placename" content="">
<!-- favicon -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<!-- canonical -->
<link rel="canonical" href="Url">