Preface
"My salary card is from the Bank of Communications, but I often withdraw money from the ICBC ATM downstairs from my home;
I am from Shanghai, and I can communicate with my classmates in Guangzhou in Mandarin;
The faucet broke today, so I went to the plumbing store and bought a new one to replace it;
I am traveling to France and my French friend was notified to pick me up at 15:30 Beijing time. "
Similar things happen every day in life. Such things seem to be normal and nothing special. However, have you ever thought about:
Why are all bank cards the same size?
Why can I communicate with my classmates in Guangzhou using Mandarin?
Why does the screw of the new faucet I bought just connect to the old water pipe?
Why don’t French friends pick me up at the wrong time?
For many things in daily life, we do not notice that there is a hidden "factor" at work behind it, and this factor is: standards.
With the "bank card standard", you don't have to worry about the different sizes of cards in different banks. The card entrances of all cash machines are the same;
With the "Putonghua Standard", people across the country can communicate in language conveniently;
With the "industry standard for screws", if you buy a 6-point faucet, you can definitely connect it to a 6-point water pipe;
With Greenwich Mean Time, people all over the world will never catch the wrong flight time.
All walks of life have their own corresponding standards and norms. Standards can facilitate communication, promote collaboration, and improve efficiency.
For the IT industry, the diversity of devices and information requires standards to ensure communication and collaboration between them. We may exchange data between mobile phones, printers, and digital cameras; we may transfer information between websites, emails, and office software; we may need to apply existing resources in future new devices (such as set-top boxes, information appliances). If there is no unified standard, then all information now is isolated, cannot be shared, and cannot be reused; we need to waste a lot of manpower and material resources to re-establish data for new devices; we need to do special development for each multi-system application .
Fortunately, we have found a solution, which is XML.
XML is simply a "document with a prescribed format". As long as the data generated by our devices or systems comply with this format, mutual data exchange, sharing and collaboration can be achieved.
Since the International World Wide Web Organization (W3C.org) launched the XML 1.0 specification in 1998, a large number of XML standards have been applied in our lives, such as weather forecasts and stock quotes that we subscribe to on our mobile phones. These data are all obtained from corresponding systems. Obtained and then sent to you through XML format conversion; we send messages to friends’ mobile phones who are not online through QQ or MSN, and the information is also realized through XML conversion; there are more commercial applications, such as within the company Data interaction, integration and sharing between CRM, ERP and content management systems all use XML.
Then, you will naturally think: Should web pages (web) also follow XML standards? The answer is yes.
After the emergence of the World Wide Web, it has greatly changed the way people obtain information. In the past, information was obtained from newspapers, TV, and radio. Now it is more convenient to obtain information through the Internet and through browsers. The information on the web is also becoming increasingly abundant. From simple, static document and picture information at the beginning, to dynamic and interactive multimedia information now, the information on the web has become so abundant that it can be described as "scary". By the end of last year, the Google search engine had been able to search 8.2 billion web pages and 2.1 billion images. So much data is wealth, but if it cannot be effectively utilized and searched, it is "information garbage". In fact, data redundancy has occurred and information cannot be effectively shared and queried.
99% of our websites are made using HTML, and HTML does not conform to the XML format. Therefore, it is difficult for these web page information to adapt to the requirements of new devices and data sharing in the future. What to do? The International World Wide Web Organization (W3C.org) has proposed a solution. They have formulated a new specification XHTML1.0 based on HTML and in accordance with the XML format. With simple changes, HTML can be converted to XHTML, thus realizing the transformation to XML. transition. At the same time, in order to make your page information easier to search and reuse, the XHTML code needs to have a clearer structure and more semantic tags. W3C recommends using CSS to control presentation to separate content from presentation.
This is what our book is about: Reconstructing your website using web standard technologies.
1: Understand web standards
1. What are web standards?
First, we need to clarify a concept. The web standards we talk about in this book do not refer to XML, but to a series of technical specifications formulated by W3C and ECMA in order to realize the transition of large amounts of HTML information to XML standards. Currently, they mainly include XHTML1.0, CSS2.0, and DOM1. 0 and ECMA JavaScript. Web standards are not just a specification, but the collective name of a series of specifications.
Web pages produced according to these specifications comply with XML format specifications and separate content and performance, allowing your page data to be shared, exchanged and reused in the future.
Below, let’s go over some important basics. If you have already mastered it, you can skip and read Section 2 directly.
2. What is w3c?
W3C is the abbreviation of "World Wide Web Consortium", which is called the World Wide Web Organization in Chinese. It is an international industry association focused on "leading and developing web technology". It is led by Time Berners-Lee, the inventor of the World Wide Web, and was founded in 1994. W3C already has more than 500 members - including Microsoft, America Online (the parent company of Netscape), Apple Computer, Adobe, Macromedia, SUN and various mainstream hardware and software manufacturers and telecommunications companies. The society's main research is hosted by three academic institutions - the Massachusetts Institute of Technology (MIT) in the United States, the European Research Forum on Information and Mathematics (ERCIM) in France, and Kekei University (KEIO) in Japan.
The main work of W3C is to research and formulate open specifications (de facto standards) to improve the interoperability of web-related products. The formulation of W3C recommended specifications is completed by working groups composed of members and specially invited experts. The working group's drafts (Drafts) are submitted to the W3C Council for discussion after being approved by the majority of relevant companies and organizations. After formal approval, they become "Recommendations" and released. For more information you can visit the W3C website: www.w3.org
3. Standards published by W3C
3.1 HTML4.0
HyperText Markup Language (HTML, Hypertext Markup Language) is widely used in today’s web pages. The purpose of HTML is to add structural information to documents, such as indicating titles.
Represents paragraphs; the browser can parse the structure of these documents and express it in the corresponding representation. For example: the browser will display the content between... in bold.
Designers can also use CSS (Cascading Style Sheets) to define how a certain structure will be expressed.
3.2 XML1.0
XML is the abbreviation of Extensible Markup Language (Extensible Markup Language). XML is a markup language similar to HTML. The difference is that HTML has fixed tags, while XML allows you to define your own tags, and even allows you to define multiple sets of settings for a document through XML namespaces. Look at an XML example:
<addressbook>
<entry>
<name>AJIE</name><email>[email protected]</email>
</entry>
<entry><name>ALLAN</name><email>[email protected]</email>
</entry>
<entry><name>YAHOO</name><email>[email protected]</email>
</entry>
</addressbook>
Some XML applications, such as XHTML and MathML, have become W3C recommended specifications. You can also define the representation of XML tags through style specifications (CSS and XSL). XML documents cannot currently be displayed directly with a browser. Page presentation still uses HTML or XHTML. XML is now mostly used for data exchange between servers (systems and systems).
3.3 CSS2.0
CSS is the abbreviation of Cascading Style Sheets. CSS can control the presentation of HTML or XML tags. W3C recommends using CSS layout method to make the web simpler and the structure clearer.
3.4 XHTML1.0
XHTML actually redefines HTML according to the XML specification. Its tags are consistent with HTML4.0, and the format strictly follows the XML specification. So, although XHTML displays the same as HTML in the browser, if you want to convert to PDF, XHTML will be much easier.
XHTML has three DTD definitions: strict, transitional, and frameset. DTD is the abbreviation of Document Type Definition. It is written at the beginning of the XHTML file and tells the browser what specifications this document conforms to and what specifications are used to parse it.
3.5 DOM1.0
DOM is the abbreviation of Document Object Model. DOM gives scripting languages (similar to ECMAScript) unlimited capabilities. It gives scripting languages easy access to the entire document's structure, content, and presentation.
4 What is ECMA?
It is the abbreviation of "European Computer Manufactures Association", which is called European Computer Manufacturers Association in Chinese. It is an organization established in 1961 to establish a unified computer operating format standard-including programming language and input and output.
ECMA is located in Geneva, adjacent to the headquarters of ISO (International Standards Organization) and IEC (International Electrotechnical Standardization Agency). Its main task is to study information and communication technology standards and publish relevant technical reports. ECMA is not an official organization, but is composed of mainstream manufacturers who often cooperate with other international organizations.
4.1 Standard ECMAscript published by ECMA
ECMAscript is a standard scripting language based on Netscape javaScript. It is also an object-based language, and any object on the web page can be manipulated through the DOM. Objects can be added, deleted, moved or changed. This greatly improves the interactivity of web pages.
The above standards are the main standards we are currently using during the transition from HTML to XML, and are also the main scope of this book.
5. Advantages of web standards
5.1 Ease of use
Pages made with web standards are more "transparent" to search engines, because a good and clear structure allows search engines to easily judge and evaluate information, thereby establishing more accurate indexes. Pages made according to web standards can also display the basic structure normally in older browsers. Even if the CSS/XSL style cannot be parsed, it can still display complete information and structure.
Pages that comply with web standards can also be easily converted into other format documents, such as database or word format, and can also be easily transplanted to new systems - hardware or software systems, such as Internet TV, PDA, etc. This is the inherent advantage of XML.
Pages that comply with web standards also have inherent "accessibility". Not only can ordinary browsers read them, but people with disabilities can also use them normally through blind browsers and voice readers.
5.2 Backward compatibility
Pages built using web standards will work well in new browsers or new network devices in the future. We only need to modify the CSS or XSL to customize the corresponding form of expression.
2: Thoughts and debates on web standards
Through the above introduction, we have a preliminary understanding of why W3C wants to establish an XML standard and why major manufacturers are willing to support XML. We also learned that in order to transition to XML standards, what web standards do we need to learn and master at this stage? The next step is to apply them specifically. But we found that the application was not as smooth as imagined, and there were still a lot of difficulties before us:
99% of web pages created using HTML4.0 or older specifications need to be converted to XHTML;
There are still a large number of new pages published every day using technologies that do not comply with web standards;
Lack of easy-to-use, powerful page development software that supports web standards;
The mainstream browser IE has incomplete support for web standards;
A large number of designers need to understand web standards and change their concepts;
Among them, "changing ideas" is the most important and difficult. Many designers still don’t understand web standards and are still waiting to see or even oppose them. Here we analyze the typical problems and debates encountered in the promotion of web standards:
(1) About web standards
1. Web standards are not “standards”, why should I comply?
Indeed, web standards are not standards, they are just recommended specifications formulated by W3C. W3C does not mandate or supervise the implementation of the industry. In order to facilitate the promotion of these specifications, the web standards organization (webstandards.org) refers to them collectively as "web standards". Although the W3C is only a "recommended specification", it is already a de facto standard, a specification recognized by members of the world's top 500 major IT companies. You have no reason to doubt its breadth and feasibility. Microsoft is also a major member of the W3C and will definitely support the specifications it has passed. However, due to commercial competition considerations, Microsoft usually makes some detailed adjustments to bind users, but this does not affect the directionality and authority of the W3C specifications.
2. Is DIV+CSS a web standard?
DIV+CSS is only a specific technical means of implementation and does not cover web standards. Web standards are not only the conversion of HTML to XHTML, but more importantly, the information structure is clear and the content and performance are separated, and DIV+CSS technology can better realize this idea. Therefore, most of the standards-compliant pages we see are made using DIV+CSS.
(2). About the benefits of web standards
1. Technology is advancing, network bandwidth is getting larger and faster, and speed is getting faster. Does it make sense to save those bytes?
One of the benefits of web standards is that pages made with web standards have a small amount of code and can save bandwidth. This is just a side benefit of web standards, because the structure of DIV itself is simpler than TABLE. The nested layers of TABLE layout cause bloated code and expanded file size. Under normal circumstances, using DIV+CSS for a page with the same performance saves 2/3 of the code than using TABLE layout. This is the inherent benefit of web standards. As for the significance of saving bandwidth, it is not mainly for ordinary users, but mainly for website operators, especially medium and large websites, such as Sina and NetEase. A news homepage is reduced from 500K to 170K. Assuming that the pageviews per day are 30 million (conservative number), the saved server traffic is 330k*30000000=9440G. This cost saving is considerable.
2. Do I need to consider people with disabilities (blind and partially sighted)?
Providing convenience for people with disabilities to browse the Internet is a legal requirement in the United States and some European countries. Due to the clear structure and complete semantics of web standard pages, some related devices can easily and correctly extract information to people with disabilities. Therefore, making it easier for blind people to read information has become one of the natural benefits of web standards. As for some people who say that there are still many people in China who are worried about food and clothing, they have no time to consider people with disabilities. This is an issue of social civilization and social morality, which is beyond the scope of this book. But if your page is made according to web standards, you can achieve this effect, why not?
(3).About layout
1.Can’t tables be used in web standards?
First of all, we need to clarify a concept: web standards do not allow the use of TABLE tags. TABLE is also a standard tag in XHTML1.0. We just advocate using DIV+CSS layout to replace the traditional table layout. The reason is: the original TABLE layout mixes performance and content, the structure is unclear and the content is incomplete, which is not conducive to the reuse of content. And semantically speaking, when W3C formulated the TABLE tag, it only used it to define the table structure. If there is a table in the document, then TABLE should be used. The performance things such as typesetting and positioning should be controlled by CSS.
2. It is very convenient for me to use table layout to revise the version. You may not be more efficient than me if you use CSS.
In some cases or projects, as you said, it may be possible to use table layout to revise the version very quickly. But this is not a long-term solution. We need to look at the essence through the phenomenon. Web standards separate content from presentation. All styles, styles, layouts, etc. are separated and controlled individually by CSS or XSLT. After such separation, , revision is the real convenience. And "revision" is not just a revision on the browser. If I need to publish the same page to a mobile phone, the page that complies with web standards only needs to modify the style file, while the table layout needs to be completely redone. If I still need to publish it in the future, Need to publish it to Internet TV or other new devices? CSS must be more efficient than table.
3. Can beautiful pages be created using web standards?
Since the people who researched and promoted web standards at the beginning made the pages relatively "simple", this caused everyone's misunderstanding, thinking that web standard pages are simple, light on graphics, and light on visual effects. In fact, the page effects that can be achieved with TABLE layout can basically be achieved with CSS. This question does not require much explanation. It will be clear just by looking at the newly established web standard sites at home and abroad. For example: www.macromedia.com , www.mp3.com
(4).About browser compatibility
1. I don’t need to care about web standards. IE occupies 99% of the market. As long as the pages I make can be viewed by IE, that’s fine.
"User-centered" is usually a shield used by those who oppose web standards. In fact, it is a hypocritical "user-centered". You can't guarantee that IE will always monopolize the browser market, and you can't guarantee that IE won't make any changes (in fact, Microsoft's IE7 has begun to improve its support for web standards). Pages that insist on using html+table layout will be "dead" information, inconvenient to search, and cannot be reused and shared. In the long run, this is the greatest harm to users.
2. Why is web standard page compatibility not good?
We say that the advantage of web standards is good compatibility. This compatibility refers to backward compatibility and compatibility with new browsers and new devices. For existing browsers, because they have different levels of support for web standards, pages may be deformed under different browsers. We have to use some "hack" techniques to achieve compatibility with different browsers. This is helpless and inevitable. It is an inevitable process that the development of web technology must go through, and it is a difficulty that must be overcome in our transition to XML.
(5).Others
1. Without useful development tools, do I have to write code by hand?
Yes. We recommend that you write code by hand to promote a deeper understanding of web standards. In fact, many development software have begun to support web standards. You can take a look at the latest version of Dreamweaver 8, Adobe's Golive, and Microsoft's Visual Studio.NET 2005. These tools already support the development of web standard pages. When new technology emerges, our attitude should be to understand, practice and evaluate it, rather than blindly opposing it or waiting for it to take effect, otherwise you will always be a laggard.
2. The boss doesn’t understand and the customers have no requirements. Why should I use web standards?
If you or the development team are not familiar with web standard technology, there are indeed risks (technical and cost risks) in adopting web standards for new projects. You can decide whether to adopt web standards after evaluation. But if you have the ability to adopt standards and still fool your bosses and customers, this is a matter of professional ethics and professionalism.
Three: Future and Direction
I think you, like me, are concerned about what the future of WEB will be like and what the next round of new technology hot spots will be. In fact, to answer this question, no one is more authoritative than W3C. Just look at what W3C is doing and what specifications it is studying to know the direction and trend of WEB.
W3C clearly tells us: There is no doubt that XML is the future trend, and openness and sharing are the spirit and fundamental driving force of the Internet.
Tim Berners-Lee, W3C leader and the father of the World Wide Web, said: XML provides a means of information exchange, but this is only the beginning. Our goal is to make the web semantic, that is, to make the information content on the web easier to understand, exchange and share. RDF and OWL languages will provide more powerful support in this regard.
Web technology is about to embrace a new round of change and development. If you are still hesitating whether you need to learn web standards, you will lose this opportunity.