<\/span><\/h2>\n\n\n\nB\u1ea1n c\u00f3 th\u1ec3 t\u1ed1i thi\u1ec3u h\u00f3a \u1ea3nh h\u01b0\u1edfng c\u1ee7a reflows, hi\u1ec7n t\u01b0\u1ee3ng nh\u1ea3y n\u1ed9i dung ho\u1eb7c c\u00e1c h\u00e0nh vi kh\u00f4ng th\u1ec3 d\u1ef1 \u0111o\u00e1n \u0111\u01b0\u1ee3c tr\u00ean m\u1ed9t s\u1ed1 widget JS kh\u00e1c (ch\u1eb3ng h\u1ea1n isotope, masonry, m\u1ed9t s\u1ed1 slider\/b\u0103ng chuy\u1ec1n…). Chi\u1ec1u r\u1ed9ng v\u00e0 chi\u1ec1u cao c\u1ee7a \u1ea3nh ph\u1ea3i c\u00f3 kh\u1ea3 n\u0103ng t\u00ednh to\u00e1n \u0111\u01b0\u1ee3c b\u1edfi tr\u00ecnh duy\u1ec7t tr\u01b0\u1edbc khi b\u1ea3n th\u00e2n ngu\u1ed3n \u1ea3nh \u0111\u01b0\u1ee3c t\u1ea3i v\u1ec1:<\/p>\n\n\n\n
<img\n style=\"width: 350px; height: 150px;\"\n\tdata-srcset=\"http:\/\/placehold.it\/350x150 1x,\n http:\/\/placehold.it\/700x300 2x\"\n data-src=\"http:\/\/placehold.it\/350x150\"\n class=\"lazyload\" \/><\/code><\/pre>\n\n\n\nV\u1edbi c\u00e1c \u1ea3nh ph\u1ea3n h\u1ed3i linh ho\u1ea1t, k\u1ef9 thu\u1eadt m\u1edf r\u1ed9ng t\u1ef7 l\u1ec7 CSS intrinsic ph\u1ea3i \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng:<\/p>\n\n\n\n
<style>\n.ratio-container {\n position: relative;\n}\n.ratio-container:after {\n content: '';\n display: block;\n height: 0;\n width: 100%;\n \/* 16:9 = 56.25% = calc(9 \/ 16 * 100%) *\/\n padding-bottom: 42.86%;\n}\n.ratio-container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: block;\n}\n<\/style>\n<div class=\"ratio-container\">\n <img\n data-sizes=\"auto\"\n data-srcset=\"http:\/\/placehold.it\/175x75 175w,\n http:\/\/placehold.it\/350x150 350w,\n http:\/\/placehold.it\/700x300 700w,\n http:\/\/placehold.it\/1400x600 1400w\"\n data-src=\"http:\/\/placehold.it\/700x300\"\n class=\"lazyload\" \/>\n<\/div><\/code><\/pre>\n\n\n\n