In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "what are the rules that html5 should follow", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what rules should be followed by html5" can help you solve your doubts.
Html5 should follow the rules: 1, good use of DIV to layout; 2, separate the HTML tag and CSS stylesheet; 3, optimize CSS code; 4, optimize JS file and put it at the bottom of the page; 5, make good use of title elements; 6, use the appropriate HTML tag in the right place; 7, avoid abuse of div tag.
The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.
HTML has gone through nearly 20 years of development. From HTML4 to XHTML, and then to the nearly very hot HTML5, it has almost witnessed the development of the entire Internet. However, even now, there are many basic concepts and principles that developers still need to pay close attention to. The editor of Web front-end development training introduces these HTML5 development principles that should be followed.
1. Make good use of DIV for layout
When developing a Web page, one thing to consider is to distinguish the focus of the page. Enclose this content in DIV tags, and the page's code will be neat and well indented.
2. Separate HTML tags from CSS stylesheets
A good page should separate HTML tags from CSS stylesheets. This is a principle that every Web developer should know when coming into contact with Web development. However, to this day, there are still many developers who do not strictly follow this principle.
Do not embed stylesheet code in HTML tags. Developers should get into the habit of creating separate files to store CSS stylesheets. This will also make it easier for other developers to get the job done quickly when they modify your code.
3. Optimize the CSS code
Nowadays, it is common to add multiple CSS files to a website. However, when the site contains too many CSS files, it will slow down the response time of the site. The solution is to streamline the code and optimize multiple CSS files to merge them into one file. This method can significantly improve the loading speed of the website. In addition, there are many tools that can be used to optimize CSS files, such as CSS Optimizer, Clean CSS, and so on.
For CSS, we have also recommended 10 excellent CSS frameworks that you should know. You can learn about the types and related uses of CSS frameworks.
4. Optimize the JS file and put it at the bottom of the page
Like CSS, it is common to add multiple JS files to a page. But this will also slow down the response speed of the site. To this end, developers should streamline and optimize these JS files.
However, unlike CSS, browsers generally do not support parallel loading. That is, when the browser loads the JS file, nothing else is loaded at the same time. As a result, the loading speed of the web page seems to be slower.
A good solution is to put the load order of the JS file after that. To achieve this, developers can place JS code at the bottom of the HTML document, and a good place to put it is close to the tag.
5. Make good use of the title element
Elements such as span to H7 are used to highlight the key points of the page. This helps users pay more attention to the key parts of the page. For blogs, I recommend using the span tag to highlight the blog title. Because the blog title is almost an important part of the page.
6. Use the right HTML tag in the right place
HTML tags are the key to constructing a canonical content structure. For example, the < em > tag is used to highlight key points. The < p > tag is suitable for highlighting paragraphs of articles. If you want to add blank lines between paragraphs, do not use the < br / > tag.
7. Avoid abusing div tags
Not all block elements should be created with < div > tags. For example, you can add display:block to the attributes of an inline element and display it as a block element.
8. Attribute values are uniformly quoted
Although some attributes in HTML5 can be unquoted, each attribute is enclosed in quotation marks for standardization.
9. Avoid a line of code that is too long
The size of the page is limited, and if the code is too long, a scroll bar will be added, making the code less readable.
10. Add img tag to alt
After the image attribute is added to alt, when the picture cannot be displayed, the content of alt can fill the blank of the picture, and alt is also good for SEO optimization.
11. Blank lines and indents
When learning Java, the teacher taught us to add comments, blank lines, and indents to the code to make it readable.
12. Close the label
The vast majority of tags in html appear in pairs. If some tags are not closed, there will be problems such as document misarrangement. Even if some tags can use single tags, it is best to unify them into closed tags, such as p. And like meta, it's best to write it in the following form:.
After reading this, the article "what rules should be followed by html5" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.