Front-end specifications
A well-regulated code is easy to modify and understand, so the following is a summary, hoping to avoid detours;
Basic Content, Please bypass ......................
1. Naming rules
Naming must be meaningful. After all, writing the code down is not for you. In css, write the parent element in front to regulate it. Do not be lazy.
2. Please do not write native for a while and jquery for a while
Many people think that I can't write a function, but the page is messy. If it is because you are not skilled, this is an opportunity to become proficient.
3. indentation
Although many editors have made indentation perfect, there will still be a gap between two spaces. In this case, do not be lazy. This space is like an ant on the ground. Hurry and clean it.
4. Tag Closure
Although in HTML5, tags do not need to be closed, but for the sake of standardization, but also for the sake of better code to avoid some errors, I suggest you close tags
5. After writing the code, delete unnecessary comments, spaces, and empty tags.
Many people add comments for the next modification, or modify the code. They will not delete the original one just in case, but have forgotten to comment it later, at this time, after writing the code, check it again and delete unnecessary ones so that you can better read the code.
6. logic problems
I can only tell you this question: when setting up a page, use your brains and properly standardize the structure, as well as js. Please keep the logic smooth, reverse Thinking will make people watching your code go viral
7. Do not write px after 0
Prompt in webstorm, do not burden the code
8. Pay attention to space issues
When you encounter the above structure, write it in one line. Otherwise, you will suddenly find that the browser has some spaces.
9. js obtains page elements,
In JQuery, if this element is used only once, do not define that the variable occupies the memory.
10. Add at the end;
Add at the end of js and css statements; it is not easy to make mistakes when compressing code