Home  >  Article  >  Web Front-end  >  Regarding the development method of DIV CSS, we also need to listen to other voices. (Repost)_html/css_WEB-ITnose

Regarding the development method of DIV CSS, we also need to listen to other voices. (Repost)_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:28:07894browse

I have similar views to the author. The standard is good, but it may not be practical.
The following is a ZT article:
Over the years, many excellent articles have praised the superiority of CSS-based design and lamented the advantages of table-based design. The decline of design. But few people think about it from another angle, perhaps because you have to understand and use CSS-based design before you can criticize it, and once you understand it, you are not willing to go back to the original old-fashioned design method.

In order to make up for this imbalance, and because it’s cool to play a villain in this game, I decided to write an article about why in some cases, the traditional table design method is not enough. It is no better than CSS-based or standards-based design methods, and it is no worse than them.

1. Demonized tables

Before the appearance of tables, the Web was a rather boring place. It was the use of table layout that opened up a new situation in visual page design. It may be debatable how much tables have contributed to popularizing the Web and Web design, but there is no doubt that we web designers will lose our jobs once we move away from tables.

Table-based design has really been demonized in recent years. Web purists will tell you that tables are meaningless for typography, so you should never use them. However, history has proven that many technologies were originally designed to achieve a certain goal, but found greater use in other fields and showed their talents. Just like the Web itself, it was not just for sharing research data at the beginning, but now it has applications in entertainment and business as well as information and education.


2. Just for comfort

Web designers have been using tables to layout pages for many years, and this is a capability that most designers have mastered. Using tables in this way ensures that you get the desired effect, and with a few simple hacks like spacing gifs, we can almost guarantee that our site will look the same on the widest range of web browsers, from the lowest version of Netscape 4 to Modern browsers like Safari.

Although pioneers have been promoting Web standards for a long time, most websites are still developed using tables and standards-incompatible code, so user agents have to support table-based layout for a long time . This is a fatal blow to the selling point of Web standards: standards do not have the status they deserve. It's unlikely that a major browser manufacturer (well, let's say Microsoft) suddenly releases a browser that won't display most websites.

So web designers never feel the sense of crisis and necessity to start using code based on CSS layout and supporting standards.


3. Lowering the threshold Web

It is so successful precisely because of its low threshold: HTML is a simple and easy-to-learn language, and browsers can tolerate many documents with confusing markup. This makes publishing content on the web incredibly easy. Even your 12-year-old nephew can whip up a simple website using Frontpage that comes with Microsoft Office.

Table-based design is better than CSS-based. Of course, the syntax of CSS is very simple. Normal people will agree: you don’t need to be a rocket scientist to learn CSS. Still, some of the concepts are too subtle to grasp. For example, on the surface, the Box model is very simple, but I still occasionally slip up on margin collapsing. The concepts of float and clear are also difficult to understand and difficult to use. In my experience, it takes about 6-12 months to go through a learning curve from understanding the basic concepts of CSS to being able to use CSS to develop websites freely.

Then there is the issue of browser support. Once you officially start working, you will slowly understand which browser supports what, what does not support, and some common browser bugs. Unfortunately, there are too many bugs, and even "experts" have difficulty estimating the time they spend fixing bugs. It’s even more frustrating for newbies, because they don’t know if it’s because they misunderstood CSS or if it’s some obscure browser bug? Perhaps this is why the same questions appear again and again on mailing lists such as CSS-Discuss.

If browser manufacturers finally get their act together, developing sites with CSS will be much easier. But I still think that most people will agree that the threshold for CSS development is still too high compared to table-based development. In other words, I think this explains why CSS-based design is so popular among web experts. This allows them to distinguish themselves from those amateur "front-page cowboys" and allows them to regain the feeling when the Web only belonged to their own small group. Perhaps this is why so many people regard Web standards as an untouchable "ivory tower", but so many advocates of Web standards view web design with fanaticism and a sense of superiority.


4. Some things are easier to do with tables

I am sure we have all found that we have written a lot of things to achieve functions that are a piece of cake to do with tables. Complex CSS. For example, when dealing with the appearance of forms, forms with complex and weird shapes can be easily handled using tables. You can achieve a similar result using CSS floating elements, but it's much more troublesome. If you are a CSS guru, this kind of trouble is also a joy. But there is no doubt that if you are just an ordinary person and you have a boss who will grab you by the throat and ask you why it took you so long to make a small form, things will not be so fun.

If you have enough knowledge and patience, most of the things you are used to doing with tables can still be achieved with CSS. Although it may take longer, there is still a limit (or you may be so discouraged that you give up trying). The key is that there are some things that no matter how hard you try, you can't achieve, and one of them is the page footer. I often see posts from frustrated CSS authors trying to create footer bars that stick to the bottom of a window so that it works even if the window doesn't stretch to the entire screen. If a table is used, it is very simple to create this effect, but using CSS alone is another matter. Why are there still web developers reluctant to use CSS? It's because once you don't use forms, simple things become complicated.


5. Exaggerate the benefits

There are many reasons for you to abandon tables and adapt to CSS-based layout. However, in the torrent of promoting Web standards, many people have exaggerated the benefits. Larger sites can indeed save a lot of bandwidth by switching to CSS layout. But for most other sites, the benefit is so small that it can be ignored.

Everyone wants pages to load faster, and standards advocates say CSS can help you do that. Most site "designs" are evenly distributed throughout the site, but CSS-based "designs" are placed in one to more files. These files can quickly become complex and large, even for a small site. A site I recently designed used 4 stylesheets, which totaled 12k in size (including whitespace and comments). Using CSS actually loads it first and then browses it, rather than evenly distributing the data to be loaded throughout the site. In other words, the homepage takes longer to download than using table layout. However, if the style sheets have already been downloaded, they will be cached and do not need to be downloaded again. But after all, the homepage of a site is the page you least want to load so slowly.


6. Attracting customers

Even if sometimes web designers feel that it is necessary to sell web standards to customers, the regrettable fact is that most of them Customers don't care whether the site's code is good or bad. We generally use a carrot and stick approach, where the carrot is friendliness to search engines, and the stick is the accessibility of the web page.

It is true that search engines prefer pages with semantic markup, and everyone also believes that search engines like short codes. Building a site through CSS and Web standards can greatly improve the search engine-friendly site. development. There is no silver bullet, however. Many table-based sites still achieve high search engine rankings. Sites developed with CSS may still get a poor ranking. The key to high rankings is content and links from elsewhere, not tables or CSS for layout.

In addition, regarding the use of customers' reverence for the word "affinity" to tie in Web standards, especially CSS design, in fact, table-based design has no inherent affinity flaws. As long as the table is linearized, it will make sense and the content will have affinity. . Current screen reader technology is pretty good, and most screen readers can support table-based sites very well. Of course, it is best for the grammar of your site to be certified through the AA affinity level. Even for the more stringent AAA level, not using a table design is just a suggestion, not a necessity.

Another often mentioned benefit is the ability to make clients independent of design providers. In a world where everyone develops according to standards, it's easy for a customer to switch development partners, and the new developer can quickly understand the organization of the site without having to wade through the mire of the previous person's markup. But this requires a large number of design providers to be proficient in Web standards. Unfortunately, this is not the case now. Although the number of experienced CSS developers is increasing, this is still a relatively professional field. Therefore, it is still risky for large companies to lock in this development method - there is a lack of skilled developers. My personal experience is that if an organization wants to use CSS to develop a website, it must maintain at least one experienced designer for a long time. So now the move to Web standards does not reduce customers' dependence on developers, but increases it.


7. Summary

There is no doubt that Web standards and CSS-based design are the way of the future. But in the process of running towards them and advocating new technologies, we also wonder whether what we are advocating is too exaggerated. Making something realistically often falls short of our expectations. And pursuing these dogmatically is likely to alienate the partners we most deserve to win.

Table-based design will be around for a long time. To attract developers, we can use examples to teach people how to get started and lower the threshold. Let alone create new thresholds. We have to honestly look at the benefits and costs. Developing a CSS site can be difficult and time-consuming, and in some cases using tables for layout makes much more sense than CSS.

Text: Andy Budd / Translation: Jjgod Jiang

Translated from An Objective Look at Table Based vs. CSS Based Design

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn