Home > Article > Web Front-end > DIV CSS Learning Diary-Why use DIV CSS (transfer)_html/css_WEB-ITnose
Nowadays, DIV CSS has become a new standard for making web pages, so many web designers have switched from using Table tables to using DIV CSS. But many people don’t know why they should use DIV CSS, resulting in I have a misconception that table is much easier to use than DIV, and DIV layout is so complicated and difficult to learn, so there is no need to waste time on it. Let’s talk about the new standards for this kind of web page after learning DIV CSS. some benefits.
First of all, it is no longer the past. Most people use IE browser when surfing the Internet. For example, some people prefer to use FireFox, NetScape, and Opera. The latter three browsers now support the new WEB standards. , and the new IE7 will also fully support this WEB standard, which means that when you use these browsers to open some old web pages, you may see a terrible page. The reason is that the new WEB standard regulates some pages Layout modes (DIV, table) and CSS functions make web pages more standardized. I think the biggest benefit it brings is that such web pages are easier to be searched and analyzed by search engines.
Let’s talk about this new WEB standard. Here is an article quoted. I believe you will have a preliminary understanding of this standard:
Web Standard 2.0 has been released for so long, what exactly is a web standard? How should we understand web standards? There are many related descriptions on the Internet, and I have made some small summaries here.
1. My opinion on web standards:
The so-called web standards, as explained in some tutorials, are: structural standards and performance standards. There are many similar statements on the Internet. Here I would like to share my personal views:
a. Standards are relative and have certain limitations
As a standard itself, it is also constantly evolving. In progress. We can also join in and improve it instead of blindly following it. There is no best, only better
b. Standards are only recommended, and everyone will consciously abide by good standards
The reason why we use standards is because they are beneficial to us. Just like the ISO9000 standard currently advocated, it is only an initiative, not a force. I think it works for me, so I use it; similarly, if you think it is really not good, you don't have to use it. The standard itself should not have any compulsion. Just like playing basketball, the NBA has a 24-second offense, and we have a 30-second offense. If we want to join the NBA, we have to use other people's rules. The same applies to our joining the "World Trade Organization". If we are brave enough, we can establish our own "World Trade Organization" and issue a set of standards by ourselves.
c. The standard does not clearly mention whether to use div or table
Some friends easily equate the standard to "replace table with div". I don't think so, because table also conforms to xml rules. Pages containing tables can still pass XHTML1.0 verification.
d. "div layout" is not just about using divs for layout
We can use all possible tags (including table) to layout the page, the purpose is to achieve optimality. It just proposes a concept, a completely new model. Someone in the forum has also said, "The important thing is the update of concepts, not the code." Of course, our ultimate goal is the update of the code.
e. With this method, there is no page that fails verification. If it's just for fun, that's fine. But I'm afraid some beginners will take the validator too seriously, and even think that passing verification is the ultimate goal. My opinion is: validator is just a tool that helps us check whether our pages comply with standards, nothing more. Ultimately we still have to design our pages according to customer requirements.
2. The benefits of using web standards to build a website:
Some people may think that the purpose of using standards is to achieve standards. In fact, "Website Reconstruction" makes it clear: in order for the website to "live" longer, in order to improve the accessibility of the website, and to reduce costs, we must adopt Web standards! There are three "fors" here, and none of them are for standards. Standards are just means.
After coming into contact with "standards", I tried to make some pages that comply with "standards". At the time, it was not clear why standards were used, it was just out of curiosity. We also encountered some difficulties in the process, both technical and conceptual. However, now I am happy to use div css to create web pages for clients.
After using the standard, I feel that the code is streamlined and maintenance is easier.
The code is streamlined to shorten page loading time. Even under the current broadband conditions, we should not relax our requirements to streamline the code (I think this is also what every programmer requires of themselves). Moreover, there are still many dial-up users and mobile Internet/ Browsing users. This is a society where every second counts.
Strictly follow the standards to achieve higher compatibility. A qualified web page creator always tries to make web pages achieve the highest compatibility. Of course, he has to strike a balance between effectiveness and compatibility. Just like when we choose a husband now: he must be rich and handsome.
It is easy to maintain. I can even make the entire page look completely different by modifying the css. This saves a lot of work.
Of course, I think the most important thing about using standards is backward compatibility. To use a professional term: sustainable development. The Internet is always developing, and a good web page producer must have some foresight of future development. As far as I know now, xml will indeed be the world for a while in the future, until something better comes out to replace it.
Every year, too many websites spend a lot of money on revisions in order to keep up with the times. Because revision means starting over everything, including code and even programs.
The standard also requires us to hand over data to XHTML (or html, xml) and hand over performance to css. The two perform their respective duties and are combined.
3. Abandoned table?
After the book "Website Refactoring" came out, there may have been a lot of misunderstandings. Some friends confused standards with refactoring, or even equated them. I haven't read this book, so I can't comment.
"Modify the code to improve the internal structure of the program without changing the external behavior of the code." This is refactoring. I think "website reconstruction" means both "div layout" and "web standards". Layout talks about a method, and standards talk about a specification. These are two different things.
Web standards do not mean that tables should not be used. I have searched all over the Internet and have not found an article saying that web standards oppose the use or even recommend not using the table tag. I think it says this: It is recommended not to use the table "layout" ” and use div css “layout” instead.
Take a data table as an example. I think organizing it using table is the best solution. Of course, you can use other methods to implement it, but I dare say that it is not as simple and concise as table. (Maybe there is, but I didn’t find it?) Of course, in the learning stage, it is quite useful to force yourself not to use tables to solve all problems