My team is trying to agree on a common HTML/CSS/Javascript coding style guide. I found the Google JavaScript Style Guide, but nothing similar for HTML or CSS.
I'm specifically interested if there are some recommended class or ID naming conventions that are commonly used.
All elements must be explicitly closed (eg <p>A paragraph</p> ). Elements without content should be closed using a slash in the start tag (eg <hr></hr> and <hr/> mean the same thing). Attribute values may be written without being enclosed in quotes. Attribute values must be enclosed by quotes.
CSS is much easier and more basic when it comes to web page formatting and designing. JavaScript is tougher compare to CSS in this scenario. CSS directly defines in the <style> tag in HTML. The <script> tag should be used for JavaScript code.
A consistent, clean, and tidy HTML code makes it easier for others to read and understand your code. Here are some guidelines and tips for creating good HTML code.
Trailing white spaces are unnecessary and can complicate diffs.
Google actually has its own HTML and CSS style guide now: https://google.github.io/styleguide/htmlcssguide.html
For JavaScript, use Standard Style.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With