Some of my thinking notes on web standards (1)_Experience exchange

WBOY
Release: 2016-05-16 12:10:10
Original
1304 people have browsed it

I started learning web standards at the beginning of last year, and I have gained some experience over the past two years. I recently changed jobs and am just free at home, so I wrote something to share with everyone.

1 Understanding of web standards and W3C XHTML specifications

According to customary understanding, these two concepts seem to refer to the same thing (these things we discuss in this edition) Advanced theory"^_^). But I think, in fact, from a technical point of view, these two things have almost no correlation at all. In short, web standards are to independently implement the structure, performance and behavior of the page. More commonly speaking, it is the popular language "div+css" in today's recruitment. However, no version of W3C XHTML places restrictions on the concept of web standards. Obviously, we can use xhtml 1.1 to write a table-positioned web page. At this point, you may think that I am talking a lot of nonsense. But with any technology, you can only use it correctly when you have a clear enough understanding of the basic concepts. Let me talk about the two misguided paths of today's Web standard applications from the following two aspects:

The first situation is very simple. I think that as long as XHTML+CSS is used, it is a Web standard. The page is full of classes and ids. Feel free to define separate classes for every detail. The difference between such a page and traditional HTML is that there is an extra "/" in the img tag. In fact, it's better to go back to traditional HTML. At least I can use font easily instead of always looking up the style sheet like a dictionary. Another, more subtle, casual use of CSS I'll talk about later.

I think the second situation is more difficult to understand, that is, trying to use various complicated div nesting and css statements to achieve the performance you want. A very simple example is in a post I just saw " Rounded corners on the page without cutting the image ". First of all, I want to make sure that this idea is really good, using CSS function to "draw" the rounded corners. To do this, the designer must add a large section of code as follows in the corresponding position:




However, this seriously violates the basic concept of Web standards - the separation of structure and performance . Because it places the code used to control the performance of the web page in the structural document. Maybe you would say that it actually puts the real performance code in CSS. But I think this is a stolen concept. Because the above b tags have nothing to do with the structure of the web page, they are all empty tags. That is, it doesn't exist to put something where the document structure requires it. So they are just junk code for the document structure.

Another example may be more subtle. I have seen an article on alistapart.com before about how to implement three-way columns on a web page. The principle is probably to use three or four divs to nest each other. I think this is also a violation of Web standards. Because the order in which these div tags are placed in the code is not simply for structural needs, but for the performance of the web page.

Of course, I admit that the above point of view is overkill to a certain extent (but on the other hand, if you have to implement non-picture rounded corners, isn't it also overkill, haha). Sometimes structure and performance are not so easily separated. In order to achieve some rich performance, we have to let the structure adapt (think about the use of

). But it is important to know what is right and what is wrong. Even if we have to do something wrong sometimes.

Finally, I want to state that I am not saying "non-picture rounded corners" is meaningless or wrong. I also admire the author's intelligence and inspiration. I think this kind of technical research is just like using CSS to draw the national flag before, and it is very helpful for mastering CSS technology. However, its use should be as limited as the CSS flag and should not be adopted in practical applications. Because it violates the basic tenets of web standards.
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template