Google HTML/CSS Style Guide
Code submitted for this course must conform to the
Google
HTML/CSS Style Guide and the
Google
JavaScript Style Guide. These styles support clean, readable code
that can be efficiently accessed over the Internet.
For each submission, you should have a header that declares (at a
minimum), <!DOCTYPE html>
, <meta>
tags for both charset
and author
, and a
<title>
. Although these tags do not visibly appear
on your page, they are important for accessibility and
internationalization. The general structure should look as follows:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="author" content="Your name here">
<title>Sample HTML Style</title>
</head>
<body>
...
</body>
</html>
For JavaScript, this style includes the following features (among many others):
- Use camelCase naming conventions for variables and use meaningful
names (
customerName
instead of cstName
or
customer_name
).
- Indentation is two spaces, not tabs.
- Line width is limited to 80 characters.
- Use semicolons at the end of lines, even when optional.
- Eliminate unnecessary whitespace. No more than one blank line between
pieces of code. (But using some blank lines helps with readability to
show lines that are related as a single unit.)
Validators
Unless otherwise specified, your code must pass the
W3C Nu HTML Validator. This
tool will detect formatting errors and make other suggestions for
improving your code.
Your CSS code must pass the
W3 Jigsaw CSS Validator.
This tool will detect syntax errors in your CSS files to ensure your
styles are applied correctly.
All of your code must also pass the
WAVE Web Accessability Evaluation
tool. This tool detects problems beyond syntax errors, ensuring that
your code adheres to recommended practices for usability.