Skip to content

Commit d470db3

Browse files
[imp] Adds further details
1 parent c25f933 commit d470db3

File tree

1 file changed

+39
-17
lines changed
  • manual/en-US/coding-standards/chapters

1 file changed

+39
-17
lines changed
Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
## General html formatting
1+
## html
22

3-
These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, namely:
3+
These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, and include items from:
44

55
1. [Google's html styleguide](http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml)
66

77
### Protocol
88

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.
9+
Omit the protocol portion (http:, https:) from URLs pointing to images and other media files, style sheets, and scripts unless they are not available over both protocols.
1010

1111
This prevents mixed content issues and results in minor file size savings.
1212

@@ -17,29 +17,28 @@ This prevents mixed content issues and results in minor file size savings.
1717
<script src="http://www.google.com/js/gweb/analytics/autotrack.js"></script>
1818
```
1919

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-
20+
### Type attributes
21+
Do not use type attributes for style sheets (unless not using CSS) and scripts (unless not using JavaScript).
2422
```html
2523
<!-- Good -->
26-
<img src="joomla.png" alt="Joomla">
24+
<link rel="stylesheet" href="//joomla.org/css/main.css">
25+
2726
<!-- Bad -->
28-
<A HREF="/">Home</A>
27+
<link rel="stylesheet" href="//joomla.org/css/main.css"
28+
type="text/css">
2929
```
3030

31-
### Mark todos
32-
Highlight todos by using the keyword TODO, eg:
31+
### Capitalisation
32+
All html should be lowercase; element names, attributes, attribute values (unless text/CDATA), CSS selectors, properties, and property values (with the exception of strings).
3333

3434
```html
35-
<!-- TODO: add active item class -->
36-
<ul>
37-
<li>Home</li>
38-
<li>Blog</li>
39-
</ul>
35+
<!-- Good -->
36+
<img src="joomla.png" alt="Joomla">
37+
<!-- Bad -->
38+
<A HREF="/">Home</A>
4039
```
4140

42-
## Html formatting
41+
### Formatting
4342
Use a new line for every block, list, or table element, and indent every such child element.
4443

4544
```html
@@ -56,4 +55,27 @@ Use a new line for every block, list, or table element, and indent every such ch
5655
<li>Home</li>
5756
<li>Blog</li>
5857
</ul></div>
58+
```
59+
60+
### Semantics
61+
Use HTML according to its purpose. For example, use heading elements for headings, p elements for paragraphs, a elements for anchors, etc.
62+
63+
Using HTML according to its purpose is important for accessibility, reuse, and code efficiency reasons.
64+
```html
65+
<!-- Good -->
66+
<a href="subscriptions/">View subscriptions</a>
67+
68+
<!-- Bad - ul is a block element -->
69+
<div onclick="goToSubscriptions();">View subscriptions</div>
70+
```
71+
72+
### Mark todos
73+
Highlight todos by using the keyword TODO, eg:
74+
75+
```html
76+
<!-- TODO: add active item class -->
77+
<ul>
78+
<li>Home</li>
79+
<li>Blog</li>
80+
</ul>
5981
```

0 commit comments

Comments
 (0)