Front-end code optimization method

1. Encapsulated css styles increase style reusability. If the page loads 10 css files, each file is 1k, it will be slower than loading only one 100k css file. 2. Reduce css
nesting, it is best not to nest more than three layers . 5. Cleverly use the css inheritance mechanism. If the parent node is defined, the child node does not need to be defined. 6. Reduce the css expression . The expression just makes your code look more cool, but the waste of performance may exceed your imagination .














17. Compress local images to reduce loading time of static files (such as: https://tinypng.com/)
18. Lazy loading of images, page skeleton screen, reduce user panic when the webpage is not loaded 19. When
uploading images
, upload large- volume images after compression async and defer, css:import and link)


おすすめ

転載: blog.csdn.net/weixin_49295874/article/details/129216463