Html+css of front-end development

Source: Internet
Author: User
Tags css preprocessor

Before reading an article is that HTML and CSS actually does not work, it is possible to consider the deletion directly with Jsvascript directly to express, of course, he also gave his own views and explanations, let us come to see:

The nature of the program is data structures and algorithms, HTML and CSS can only express simple tree structure, suitable for simple content-based sites, not suitable for complex web programs. They are the core of the development: the simple change is simpler, but the complexity of the more complex. Stone houses are not necessarily built with stones.

HTML and CSS language ability, with a subset of JavaScript json (in fact, JavaScript objects and arrays) can be replaced, but the lack of basic operators, statements, functions, objects, etc., why not simply use JavaScript instead, It also maintains uniformity and flexibility. I'm not talking about specific features, which are implemented at the bottom of the browser, and JavaScript can still be used as an interface, just like node. js.

Because it is a game development background, it is not possible to use markup language such as HTML and CSS to develop such complex things as games. So, as the complexity of the Web front-end is rising, is there any need for HTML and CSS to be the language of the document site? Will hinder the development of complex programs.

As an analogy, I used Flex before, its MXML language is more flexible than HTML, but also use CSS, but unless it is a very simple page structure, in most cases, organizing pages with ActionScript is more convenient and flexible. and JavaScript development is easier to modularize. HTML and CSS are too simple, and even can be replaced with JSON, its function in the JS package.

Like many other language platforms, such as Java, the interface is developed with pure Java code. If you really need structured dynamic data, you can use JSON or XML. As for the separation of content, performance and logic, it does not need to be separated from the language level, pure JS can be separated, and more controllable. HTML and CSS logic is too weak, this is why there will be less CSS pre-compiler and a variety of template engine, if using pure JS, these can not be required.

As for browsers that do not support JS, it is basically impossible to surf the internet.

The above is an article I have read before the author supports the idea of canceling HTML and CSS, in fact, there is some truth to say, but:

The mainstream web development seldom uses the whole JS scheme. There are a few reasons for this:

1. Pay attention to those who cannot run JS user agent. Users use browsers that do not support JS (such as older mobile browsers), or disable scripts. Of course, you can choose to ignore the few users, especially now the vast majority of websites and applications are also the same choice, but at least we should keep in mind that the developers do not have the JS case of basic respect. In addition, such as mobile transcoder or some mobile browser "Speed Mode" is based on the server-side analysis and reorganization of the Web page, whether it can support JS very tough. The more important factor is the SEO friendly. If it is a full JS generated Web page, the search engine cannot index content. Because of the site, the search ranking is a vital one.

2. Pay attention to the merits of HTML/CSS itself . It is true that JS itself can realize the advantages of all HTML/CSS models, such as separation, through well-designed frameworks and libraries. But there are many uncertainties:

1) Are there good enough frameworks and libraries? To consider whether your business needs can be met, you may also want to consider performance, scalability, previously mentioned accessibility, learning curve, toolchain, and even the long-term survival of this framework and library (Maintenance, bug fixes, new features such as support for HTML5 new APIs, and so on). The point is that, in theory, JavaScript has higher elasticity, but greater freedom may not be better

2) is the impedance of the abstract model and the HTML/CSS model given by the framework and the library matched? If the framework or library essentially still uses the HTML/CSS model, but changes the syntax (for example, from markup to JSON), what are the benefits of providing it? Just a uniform grammar? If the framework or library has its own independent abstraction layer, such as widget/component, is it an additional layer of abstraction above html/css (that is, the final mapping to html/css) or just html/css as a purely implementation tool? For the former, the HTML/CSS model is actually eventually returned. The latter, the lessons that can be referred to are Http://ASP.NET WebForm and JSF.

3) Can the constraints set by the framework and the library be consistent in the development? HTML/CSS models are not perfect either in theory or in reality. But at least it is clear and easier to be executed consistently. But a single language, even if it provides a layered mechanism, can easily be bypassed-especially if the framework and library itself are not good enough, and may be inclined to hack, not to mention the urgency of deadline, due to the inability to meet the needs and bugs.

3. Focus on performance . Note that the final Web application, the page is executed in the browser, and the browser is completely designed according to HTML/CSS. Regardless of the canvas, the implementation of pure JS will ultimately generate the DOM. From the performance point of view, the pure JS generation Dom naturally catch up with the direct markup. In the same way, even with a CSS preprocessor, it will be pre-compiled at deployment-even though it can do even better at runtime (however, I don't really know if any CSS preprocessor is doing this at the moment – they're all based on pre-compiled scenarios), like html/ CSS is optimized according to the progressive display (the page does not have to download all the parts to see), and the Pure JS architecture is not designed to be difficult to do (such as the full download of JSON data you can parse, the data is available, the DOM can be generated). Although less can be performed at run time, it is inappropriate from a performance standpoint because CSS usually has to be fully seated before the page rendering. While the runtime generates CSS, it requires that at least the script to execute less is downloaded before the page rending, and then your. Less source code is parsed and compiled. This performance overhead is at least now negligible.

Another aspect of performance optimization is based on the declarative nature of HTML/CSS, which means that only the goal of high-level is to achieve greater freedom of optimization for the browser. CSS Transition/animation, for example, performs much better than JavaScript by modifying the style to achieve the desired performance.

4. Focus on the unique features of web development.

1) Html/css are declarative, that is, they do not want programmers to program. Of course, a programming language is capable of all things, but even considering the programming itself, why should there be SQL in addition to common programming languages, and configuration files written in various syntaxes?

2) HTML/CSS is standards-based. This is a huge difference from the Http://ASP.NET WebForm, JSF, Flash/flex and other proprietary technologies or standards under a language and platform. The concrete will not unfold.

3) A major difference between web development and general application development is that Web applications, Web pages ' final performance and behavior, or Web user experience, are not entirely up to the developer, but are determined by developers and users. Users who choose different devices, different browsers, different browser settings, different browser extensions, and so on, can affect the results. This is a disadvantage, but also an advantage. See how you feel.

Pure JavaScript development usually means that you want to control the user experience more, but it is not easy to write more code to do. [Add: For example, the Autofocus property on a form control, at first glance, the script can do.] But in fact the script to do is very difficult! For example, the page is already half loaded, the user starts typing in an input box, but the subsequent loaded control requires focus, which, if it is a script implementation, usually arbitrarily calls focus (), interrupting user input (especially if East Asian users are interrupted when using IME). The properties defined by the HTML itself are implemented by the browser and can be handled appropriately. In particular, you will naturally gain the user experience by upgrading from old browsers to new browsers. On the other hand, the user can actively choose the browser he wants to use to proactively upgrade his own user experience. There are many and many more of these examples. Above

Html+css of front-end development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.