What are the front-end optimization methods

What are the front-end optimization methods

Preface

The front end is huge, including various resources such as HTML, CSS, Javascript, Image, Flash, etc. Front-end optimization is complicated, and there are different methods for all aspects of resources. Then, front-end optimization is necessary.

One, http

Minimize http requests and set http caching reasonably

Second, the CSS aspect

  • Can compress CSS files
  • Pay attention to the efficiency of CSS selectors

Three, js aspect

  • Reduce modifications to the DOM
  • Use event delegation
  • Reduce the number of reflows and redraws
  • Consider using 3D acceleration for animation
  • Compress the js file

Fourth, the picture

  • Perform image compression
  • Use sprites
  • Lazy loading

Reference blog post: https://www.cnblogs.com/coober/p/8078847.html

Guess you like

Origin blog.csdn.net/wdhxs/article/details/114802130