Answer the question
In order to leave comments, you need to log in
What is the more or less common and complete "code style" format for HTML?
Hello. Please share information. Do you know some more or less common and complete "code style" format for HTML? And which one do you personally use on your projects? Something like "PSR" or "Zend Code Style" for PHP.
I read the Google HTML/CSS Style Guide (though fluently), but didn't find an answer to my question, which I started searching for the format with: what to do with tags if they start to crawl out beyond 120 characters in length. It is clear that you can do nothing, but, in my opinion, it is so extreme that it is not convenient and not visual. You can somehow transfer. It is interesting, in this regard, who does what, and whether there is a more or less popular and proven system.
Also, speaking of the "Google HTML/CSS Style Guide", I always close tags that are optional (they require not to be closed). Maybe this is an anachronism inherited from XHTML, but it seems to me that the structure of the document is more visual. What do you say?
Please share your experience, ladies and gentlemen, who is not lazy))
ps let's immediately agree that we will not argue about "tabs vs spaces"))
Answer the question
In order to leave comments, you need to log in
I do not deny the charm of such style-guides (as a fan of Python and PEP8), but I have never adhered to anything like this in layout.
It is possible that in vain, I do not know.
My main rule has always been - just keep the documents clean, both HTML and CSS, so that in case something happens, I can return, tear out / peep a piece and calmly use / change it, without pain in one place.
In CSS, at the same time, I always tried to divide attributes into thematic ones, i.e. separated sizes, colors, etc. with an empty line.
Now, out of interest, I’ll go over the advice from Google, but I don’t think so. that I will change something in my personal rules.
I follow common standards like code alignment without mess. If html comes out, then I do nothing (without indents it goes up to 120). More than 160 does not happen in general.
I don't close single tags
<img src="" alt="">
<input type="number">
z-index
will happen at the end, and background
at the very beginning, and I don’t need to strain to divide all the rules into categories.Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question