Skip to content

Commit c25f933

Browse files
[imp] The first hit
1 parent 051ce67 commit c25f933

File tree

1 file changed

+58
-2
lines changed
  • manual/en-US/coding-standards/chapters

1 file changed

+58
-2
lines changed
Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1-
## HTML
1+
## General html formatting
22

3-
@TODO - Add style guide
3+
These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, namely:
4+
5+
1. [Google's html styleguide](http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml)
6+
7+
### Protocol
8+
9+
Omit the protocol portion (http:, https:) from URLs pointing to images and other media files, style sheets, and scripts unless the respective files are not available over both protocols.
10+
11+
This prevents mixed content issues and results in minor file size savings.
12+
13+
```html
14+
<!-- Good -->
15+
<script src="//www.google.com/js/gweb/analytics/autotrack.js"></script>
16+
<!-- Bad -->
17+
<script src="http://www.google.com/js/gweb/analytics/autotrack.js"></script>
18+
```
19+
20+
### Capitalisation
21+
All html shoudl be lowercase: This applies to HTML element names, attributes, attribute values (unless text/CDATA), CSS selectors, properties, and property values (with the exception of strings).
22+
23+
24+
```html
25+
<!-- Good -->
26+
<img src="joomla.png" alt="Joomla">
27+
<!-- Bad -->
28+
<A HREF="/">Home</A>
29+
```
30+
31+
### Mark todos
32+
Highlight todos by using the keyword TODO, eg:
33+
34+
```html
35+
<!-- TODO: add active item class -->
36+
<ul>
37+
<li>Home</li>
38+
<li>Blog</li>
39+
</ul>
40+
```
41+
42+
## Html formatting
43+
Use a new line for every block, list, or table element, and indent every such child element.
44+
45+
```html
46+
<!-- Good -->
47+
<div>
48+
<ul>
49+
<li>Home</li>
50+
<li>Blog</li>
51+
</ul>
52+
</div>
53+
54+
<!-- Bad - ul is a block element -->
55+
<div><ul>
56+
<li>Home</li>
57+
<li>Blog</li>
58+
</ul></div>
59+
```

0 commit comments

Comments
 (0)