This article is a view: Follow the Web Standards for website design and improvement.
Reading objects: Website designers, web application developers
Keywords: Web Standards, XML, XHML, CSS, DOM, DOCTYPE, Accessibility
Foreword
The change on the Internet is happening every day. When we feel that the website design technology is very simple and familiar. The concept of foreign website design standardization has already been quietly formed and quickly "spread" since 2000, most of the newly issued browser versions began to support website standards. The mainstream web editing tool also begins to fully support website standards, even some software consists entirely of XML files, such as Dreamweaver MX. Some famous large business websites began to use the website standard to rebuild (such as sports information www.espn.com), and others refuse non-standard browsers to browse their websites (such as connecting magazines www.wired.com). Many design websites (for example: www.k10k.net) and personal websites are the forerunners of standard promotion, and they have turned to XHTML CSS to build. February 4, 2004 XML1.1 recommended standards officially released, marking the standard era of website design has arrived.
The situation of foreign website standards is raging, but the domestic industry seems to know after knowing the post or not interested, let's take a look at the domestic three major portal websites on the website standard:
Check item
Check the target website
Verification results
Code check (XHTML)
(Verification address: http://validator.w3.org/,
(http://www.htmlhelp.com/tools/validator/)
Www.sina.com.cn
Failure, mixed HTML, did not reach XHTML1. Yellow alert: character set error. (Defined GB2312, but use non-GB2312 characters within the page). Non-standard code 43.
Www.163.com
Failure, mixed HTML, did not reach XHTML1. Red Alert: DOCTYPE is not defined. Non-standard code 41.
Www.sohu.com
Failure, mixed HTML, did not reach XHTML1. Yellow alert: character set error. Non-standard code 38.
CSS2 check
(Check address: http://jigsaw.w3.org/css-validator/Validator-uri.html)
Www.sina.com.cn
25 error.
Www.163.com
1 Warning, 10 errors.
Www.sohu.com
1 Warning, 15 errors.
The verification results show that all portals are not in line with the website standard, and even the HTML4.0 standards are not followed. For example: label, as early as April 1998 HTML4.0 standard has been listed as "DepRecated" tab. But there are many code like on the top page of our three major portals. The simple list here is not to criticize these websites do not do well (in fact, most large business sites are not in the W3C strict correctness check), there are many reasons, such as the old information release. System, web design personnel technology and awareness are not enough. We just want to explain a little: even the website of the listed company is not realized to follow the standard, other commercial websites do not need to say that the domestic website is not sufficient.
Let us keep up with the pace of the new era, let's take a look at the website standard.
One. Why establish a website standard?
Most of us have a deep experience. Whenever we have upgraded the mainstream browser version, our new website may become too time, we need to upgrade or re-build a website. For example, 1996-1999, typical "Browser Wars", in order to be compatible with Netscape and IE, the website has to write different code for these two browsers. Similarly, whenever new network technology and interactive equipment, we also need to make a new version to support this new technology or new device, such as WAP technology that supports mobile Internet access. Similar questions: Website code is bloated, complicated to we waste our large bandwidth; for some browser's DHTML effect, some potential customers; unprystable code, disabled people can't browse the website, etc. This is a vicious circle, is a huge waste how to solve these problems? People who have knowledge have already begun to think and need to establish a standard for universally identified standards to end this disorder and confusion. Commercial companies (Netscape, Microsoft, etc.) have finally recognized the benefits of unified standards, so under the organization of W3C (W3c.org), the website standard began to be established (the XML1.0 is released on February 10, 1998), and Promote the implementation of the website standard organization (WebStandards.org).
Simply put, the purpose of the website standard is:
Provide maximum benefit to the most website users
Ensure that any website is easy to be effective for a long time
Simplify code, reduce construction costs
Make the website easier to use, adapt to more different users and more network equipment
When the browser version is updated, or when a new network interactive device appears, make sure all applications can continue correctly.
For website design and developers, follow the website standard is the standard; for your website users, the website standard is the best experience.
Visitors Rank the world 4th, China No. 1 Sina website, also encountered non-standard DHTML issues. In the latest release of Netscape7 and Mozila 1.6 browsers, the floating ads of Sina's home failure, laminated in the lower left corner of the page. Perhaps those advertisers think that these potential users don't matter. (Screenshot Date on April 12, 2004)
two. What is a website standard?
The website standard is not a standard, but a collection of standards. The web page is mainly composed of three parts: structure, performance (presentation) and behavioral (BEHAVIOR). Corresponding standards are also divided into three aspects: structured standard language mainly include XHTML and XML, and the standard language mainly includes CSS, and behavioral standards mainly include object models (such as W3C DOM), ECMAScript, etc.. Most of these standards drafted and published by W3C, and some are standards for other standards organizations, such as ECMAScript standards of ECMA (European Computer Manufacturers Association). Let's briefly understand these standards:
1. Structural standard language
(1) XML
XML is the story of the Extensible Markup Language. It is currently recommended to follow the XML1.0 issued by W3C on October 6, 2000 (www.w3.org/tr/2000/rec-xml-20001006). Like HTML, XML is also from SGML, but XML is a language that can define other languages. The purpose of XML initially designed is to compensate for the shortcomings of HTML, with powerful scalability to meet the needs of network information, and later gradually use the conversion and description of network data. The benefits of XML and technical specifications are not more to say, there are many information on the Internet, and there are many books can be referred to 2) XHTML
XHTML is the abbreviation of the Extensible Hypertext Markup Language extension identity. It is recommended to recommend XML1.0 on January 26, 2000 (refer to http://www.w3.org/tr/xhtml1) on January 26, 2000. Although the data conversion capacity is powerful, it can be replaced by HTML, but in the face of thousands of existing sites, it is also time to use XML. Therefore, based on HTML4.0, we use XML rules to expand it to get XHTML. Simply put, the purpose of establishing XHTML is to achieve HTML to XML transition.
2. Performance Standard Language
CSS is an abbreviation for the Cascading Style Sheets laminated style sheet. It is currently recommended that W3C recommended CSS2 on May 12, 1998 (refer to http://www.w3.org/tr/CSS2/). The purpose of the W3C creates a CSS standard is to replace the HTML table format layout, frame, and other languages. Pure CSS layout combined with structural XHTML can help designers separate the appearance and structure, making it easier for sites accessing and maintenance.
3. Behavior standard
(1) DOM
The DOM is an abbreviation for the Document Object Model Document Object Model. According to W3C DOM specification (http://www.w3.org/dom/), Dom is a browser, platform, language interface, so that you can access other standard components. Briefly, DOM solves the conflict between Netscaped JavaScript and Microsoft JScript, gives Web designers and developers a standard approach to access the data, scripts, and performance layer objects in their site.
(2) ECMAScript
ECMAScript is a standard scripting language (JavaScript) developed by ECMA (European Computer Manufacturers Association). It is currently recommended to follow ECMAScript 262 (http://www.ecma.ch/ecma1/stand/ecma-262.htm).
three. Follow the standard website and the traditional website
The traditional website is just the extension of the print media, the design goal is to ensure consistent in the 4-6 mainstream browser versions. The usual feature is:
Based on the table.
The content is mixed together. A typical example is the tag.
Garbage code (non-standard code).
Not easy to use code.
Semantic incorrect code. For example, if you don't explain, you don't understand this is the meaning of font.
The website with the website standard is an extensive communication communication tool that accepts a variety of users and various devices. The general feature is:
Semantic correct logo. That is, it is useful to express a meanable tag. Ensure that the code can be correctly understood in a text browser, PDAS, and search engines.
Correct and effective code. The correct code is correct by the W3C code check (http://validator.w3.org/).
The code is easy to use to people, the machine. Can accept access to users and equipment,
The expression layer and content are separated by CSS. Make the code more concise, faster download speed, larger modification and custom expressive form easier
four. Benefits and disadvantages of website standards
1. benefit
The benefits of website viewers:
File download and page display speed faster;
Content can be accessed by more users (including disabilities such as blindness, weakness, color blind);
Content can be accessed by a wider device (including screen readers, handheld devices, search robots, printers, refrigerators, etc.)
Users can choose to customize their performance interfaces through styles
All pages can provide versions suitable for printing
Benefits for website owners:
Less code and components, easy to maintain
The bandwidth requirements are reduced (the code is more concise), and the cost is lowered. For example: After Espn.com uses the CSS revision, save more than two megabytes.
More easily searched by the search engine
Easy to change, no change page content
Provide print version without copying content
Improve website ease of use. In the United States, there are strict legal provisions (Section 508) to constrain government websites to reach certain ease of use, and other countries have similar requirements.
2. Disadvantage
Need to spend more time learning standards
Still need to pay attention to browser compatibility issues
Use CSS to achieve some performance but more troublesome than the table
Fives. How to improve existing websites
Most of our designers are still using traditional table layouts to express websites with mixed structures. Learning to use XHTML CSS requires a process that makes existing websites in accordance with the website standards. The best way is to gradually enter, staged to gradually meet the target of the website standard. If you are a newbie, or is not very familiar with the code, you can also use the standard editing tool, such as Dreamweaver MX 2004, which is currently supporting the most complete tool for CSS standards.
1. Primary improvement
Add the right DOCTYPE to the page
Many designers and developers don't know what is doctype, what is used by doctype. DOCTYPE
It is the discument type's shorthand. Mainly used to explain what version you use XHTML or HTML. The browser explains the page code based on your DTD defined by your DOCTYPE. So, if you don't pay attention to setting the wrong Doctype, the result will make you very shocked. XHTML1.0 provides three DOCTYPE options:
Transitional
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
Strict strict shape (strict)
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
Frameset
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd">
For our primary improvement, as long as you choose a transitional statement. It can still be compatible with your form layout, express identity, etc., not allowing you to think too much, it is difficult to master. Tip: You are too lazy to enter the above transitional code, you can access the home page of http://www.macromedia.com/ website, then view the source code, copy the same code of the Head area to paste it.
Set a namespace (Namespace)
Add the following code directly behind the DOCTYPE statement:
A NameSpace is a detailed DTD for collecting element types and attribute names, and the Namespace declaration allows you to identify your namespace via an online address. Just simply input the code.
Declare your coding language
In order to be properly interpreted and by identifying the check by the browser, all XHTML documents must declare the coding languages they are using. code show as below:
The coding language that is declared here is Simplified Chinese GB2312, and if you need to make traditional content, you can define as BIG5.
Write all labels with lowercase letters
XML is sensitive to case sensitive, so XHTML is also different from cases. All XHTML elements and properties must be written. Otherwise your document will be considered invalid by the W3C check. For example, the following code is incorrect:
The correct way of writing is:
Similarly,
is changed to
, to change to and so on. This conversion is simple.
Add a Alt property for the image
Add a Alt property to all images. The Alt property specifies that the replacement text is displayed when the picture cannot be displayed, so that the normal user can have no, but it is critical to the plain text browser and the user using the screen reader. Only the ALT property is added, the code will be passed by the W3C correctness. Note that we have to add meaningful ALT properties, which is meaningless:
Correct way:
Give all attribute values plus quotes
In HTML, you don't need to add quotes to attribute values, but in XHTML, they must be an extension.
Example: Height = "100" instead of Height = 100.
Close all labels
In XHTML, each open tag must be turned off. Just like this:
Every open tag must be turned off. p>
HTML can accept the non-closed standard, XHTML is not. b>
This rule can avoid HTML chaos and trouble. For example: if you don't close the image tag, a CSS display problem may occur in some browsers. Use this method to ensure that the page is displayed as you design. It should be noted that the empty tag is also turned off, and a positive slash "/" is used in the tail of the tab. E.g:
2. Intermediate improvement
Next, our improvements are mainly separated by structures and performance, which is not easy to implement in the first step, and we need to transform on the concept, and the learning and application of CSS2 technology. But learning any new knowledge requires some time, isn't it? The trick is to do while doing. If you have been using the form layout, I haven't used CSS at all, nor I have to hurry to say goodbye to the form layout, you can use the style sheet to replace the Font label. As you have learned, the more you can do. Ok, let's take a look at what we need to do:
Define elementality with CSS
We have developed habits when writing logo, when you want the font to use
text can become huge, bold,
H1, H2, H3, H4, H5, H6 {
FONT-FAMILY: Song, Serif;
FONT-SIZE: 12PX;
}
Use structured elements to replace meaningless garbage
Many people may never know that HTML and XHTML element design is intended to express structures. Many of us have become accustomed to control performance with elements, not structures. For example, a list of content may use the following identity:
Sentence 1BR />
Sentence class
Sentences 3
If we use a unordered list, it will be better:
ul>
You may say "But
Add Id to each table and form
Give a form or form a unique, structured tag, for example