Apply Div + CSS web page layout to create websites that comply with web standards, which is prone to some problems.
So that you can see the problem.
I. CSS verification problems
The webpage we designed is designed to comply with the XHTML standard, and CSS is verified by W3C. Some do not pass the CSS2.0 verification. The major verification errors are: "Line: 0 font-family: We recommend that you specify a category family as the final choice"
W3C recommends that the font end with a class font instead of a single font when defining the font. For example, "sans-serif" ensures that webpage fonts are displayed in different operating systems.
Although most people define "sans-serif" on the body tag, sans-serif is missing when the font is re-defined in other IDs or classes, which is considered to fail the verification. This error is not very serious and can be avoided with a little attention.
II. CSS writing suggestions
Add comments to the CSS file. Annotations will facilitate future maintenance. We recommend that you add comments to CSS files as much as possible. Do not worry about adding a small number of bytes.
Use CSS syntax as short as possible. For example, the color value "# FFFFFF" can be abbreviated to "# FFF"; "padding-top: 30px; Padding-right: 0; padding-bottom: 10px; padding-left: 2 0px "can be abbreviated as" padding: 30px 0 10px 20px ;". There are more saving skills in definition skills. As you become proficient in CSS applications, you will find better solutions.
III. XHTML verification problems
We often pay attention to CSS verification, but it is somewhat neglected in terms of XHTML compliance with standards, and many low-level errors occur. The main problems are listed as follows:
◎ Target = "_ blank". This syntax is correct in HTML4.0 and cannot be used in XHTML1.0. One solution is to write target = "new", and another solution is to use js to process all targets;
◎ It is best not to embed a style sheet. It is easy to separate the style sheet file and maintain it. If <style> is embedded, you must write it as <style type = "text/css">. The type cannot be ignored. Otherwise, XHTML cannot determine the role of your style.
◎ <Br> it must be written as <br/>. XHTML requires that all tags be closed. Unpaired tags are directly appended "/".
◎ Use the same ID again. One ID can only be used once in XHTML. If you need to reference the style multiple times, you should use class.
◎ The Flash embedding method is incorrect. <Embed> was the first private label of Netscape. Even if it was later supported by IE, it was never recognized by W3C and there was no <embed> label in HTML4.0. W3C advocates using the <object> label. To solve the compatibility of different browsers, there is a work und that uses both labels.