DIV + CSS has been around for years, when DIV + CSS was a tempting combination of people who used DIV + CSS to make web pages, often with thumbs-up.
Today, despite the mention of DIV + CSS, there are still a lot of people who are passionate about it, but I will shake his head: DIV + CSS is not everything, but not what some people call "myths"! The myth is creating CSS, not DIV + CSS. I think it is time to correct this problem.
The essence of CSS is that each label should be used to its best.
Blindly respected DIV + CSS will only make the white astray.
1, DIV is only one of the most commonly used HTML tags
Obviously HTML is not just useful for a DIV tag, every tag has its purpose, but DIV is one of the most useful ones. If DIV can do all the other tagging features, then W3C has long streamlined HTML!
Table is not without merit, just use the table is relatively simple, easy to use was widely promoted in the early mistakes. However, table in dealing with the performance of web data, the other labels can not be replaced, but it is not suitable for the layout of the entire page.
2, the code readability
Pure DIV + CSS website's code readability is undoubtedly very poor, or even table tr and td to distinguish between rows and columns, a pile of DIV piled together, if there is no comment, you do not know a certain part What is the use?
3, semantic and structured
Now, when developing CSS, more and more mention is semantic, in the final analysis is actually the problem of the readability of the code. Semanticization is to make the code easier to read and easier to understand. For example, .text_01 {color: red} does not .text_red {color: red} is easy to understand.
The same is true for HTML, such as when we see <ol> we know that this is an ordered list; when we see the <p> tag we know that this is a paragraph with text; when we see <span> we know that this is better than <p> Small text units; see the <h1>, <h2> like to know that they are the title.
Obviously, all the pages of the div can not see these.
The structure of the page is also true, such as <div> <div> <div> <div> & hellip .. </ div> </ div> </ div> </ div> This code is clearly hard to understand Its DOM structure, but <div> <p> <h2> <span> ... .. </ span> </ h2> </ p> </ div> is much cleaner than the one above.
Believe that people who do development code semantic and structured understanding will be more profound.
4, teamwork
Low readability, poor structuring and semantics make it harder for the rest of the team to learn and maintain, which is a waste of time and energy for a team.
In fact, DIV + CSS's argument has brought us from the table to another extreme, the right web design is not a label dominate the world, but each element is using the appropriate label.
So, DIV + CSS to change a saying, (X) HTML + CSS is not more appropriate?
Please do not mention DIV anymore. White really will treat it as a baby!
In fact, looking back at the process of popularization and standardization in our country, we have already taken the wrong course. What are we doing when we are studying foreign technology such as CSS Sprites and Grid? What are we doing when foreign CSS frameworks bloom all over the world? Until now we still can only go abroad, still follow others.
Two years, we still dwell on DIV + CSS ...