Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a recommended HTML/CSS/JavaScript coding style guide? [closed]

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.

like image 648
xsl Avatar asked Feb 10 '12 10:02

xsl


People also ask

What is the recommended way or standard of styling HTML content?

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.

Which is best HTML CSS or JavaScript?

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.

Why is it important to follow the proper guidelines in encoding HTML?

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.

What does Google's style guide have to say about trailing whitespace?

Trailing white spaces are unnecessary and can complicate diffs.


2 Answers

Google actually has its own HTML and CSS style guide now: https://google.github.io/styleguide/htmlcssguide.html

like image 117
Richard Avatar answered Sep 19 '22 02:09

Richard


For JavaScript, use Standard Style.

js-standard-style

like image 40
mightyiam Avatar answered Sep 21 '22 02:09

mightyiam